
On Tue, Oct 05, 2004 at 06:05:54PM +0200, Markus Schöpflin wrote:
John Maddock wrote:
[...]
I think on some platforms <pthread.h> doesn't compile unless _REENTRANT or some similar compiler-specific magic symbol is defined: in other words it's an assert that the compiler is indeed in thread safe mode.
Yes, it's true. _REENTRANT has to be defined, there is an explicit check in "pthread.h" for this.
It looks to me as though BOOST_HAS_THREADS is getting set unconditionally for gcc on this platform, and presumably we should only set it when _REENTRANT is defined (I'm assuming that's the symbol that gets defined when the -thread option is used - can you check?).
Hold on... checked the output from config_info and looks as though _REENTRANT *is* defined, so I'm mystified. I also note that the platform is detected as "generic unix". Do you know what macros gcc defines to identify this platform?
Attached is the output of "gcc -ansi -dM". I hope it contains enough information to answer your questions. Note also that _REENTRANT is not defined here, therefore its source must be somewhere outside of gcc.
_REENTRANT is most likely be set by libstdc++-v3. IIRC, the standard library that ships with gcc 3.4.x defines it, e.g., in (some file included by) string.h, no matter whether you provided `-pthread' (or `-thread' on your platform) or not. string.h is included by config_info.cpp whence config_info reports _REENTRANT as set. Regards Christoph -- http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/cludwig.html LiDIA: http://www.informatik.tu-darmstadt.de/TI/LiDIA/Welcome.html