Tom Tromey wrote: >>>>>> "Guilhem" == Guilhem Lavaux <guilhem@xxxxxxxxx> writes: > > Guilhem> 1) POSIX syscalls where originally written with no threads in > Guilhem> mind. glibc uses a trick to store errno in a thread local > Guilhem> storage using a special function. So the expected behaviour > Guilhem> of storing errno just after the accept is true only in this > Guilhem> case. If you use other type of threaded system then it may > Guilhem> not be right (or for example if the library is buggy). > > Do these systems exist? > > I was under the impression that this errno behavior was required by > the posix threads spec. But I admit I don't have a definitive URL :-) > Googling around a little seems to indicate that while yeah, systems *should* be errno-thread-safe, some just aren't. It also seems like defining _REENTRANT or _LIBC_REENTRANT should give you a thread-safe errno in some systems.