errno value reliability

Jul 08, 2009 2 Replies

Hello All, Whenever a system call returns error, it will set the errno variable to the appropriate reason. But how far is this value reliable in case of multi threaded/ multi task environment? As there is always a possibility of context switch and hence some other task/ thread might change this value so it may not be valid at all!! Is there any standard to avoid this problem?



Thank you, Kaushal


Hi Kaushal.

set the

Not a problem since errno is in thread-local storage. See /usr/include/bits/errno.h.

Steve

l set the

Oh got it! Thanks Steve.

-Kaushal.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required