-lpthread vs -pthread: does -D_REENTRANT matter?

Jilles Tjoelker jilles at stack.nl
Sun Oct 21 12:22:47 UTC 2012


On Sun, Oct 14, 2012 at 04:55:07PM -0400, Eitan Adler wrote:
> On 14 October 2012 10:42, Jilles Tjoelker <jilles at stack.nl> wrote:

> > Because C99 does not specify threading, it allows these transformations.
> > In C11, they are forbidden. Passing -pthread disables them as well.

> Is the man page wrong or do I misunderstand?

>            This option sets flags for both the preprocessor and linker.  It
>            does not affect the thread safety of object code produced by the
>            compiler or that of libraries supplied with it.

OK, that would explain why I could not find such things.

I seem to recall GCC must sometimes be instructed not to do
thread-unsafe transformations but I cannot find how to do so.

-- 
Jilles Tjoelker


More information about the freebsd-hackers mailing list