Non thread safe primitives

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Non thread safe primitives

John Zoidberg

I've read on the FAQ that glibc 2 is by default thread-safe. But on
the manual it is mentioned on several primitives that they are not
thread safe, so the <fname>_r primitive should be used instead, but
there are even other primitives that do not seem to have a _r sibling.
Moreover, on the CHANGELOG there are references like "in glibc 2.x.x
functionality foo is now thread safe".

My "yes-or-no" questions are:
1) is glibc fully thread safe or not?
2) is the standard C library (this includes I/O) part of it fully thread safe?
3) do the _THREAD_SAFE and _REENTRANT macros converts foo() to foo_r()
automatically, abstracting the user from doing it and thus making the
code thread safe?

Thanks in advance!