Menu

#62 _PTHREADS should not be #defined with gcc 3.x

open
nobody
5
2003-03-18
2003-03-18
No

_PTHREADS is now forced-defined into config.h
by aclocal.m4 (and configure) for
"configure --with-pthreads".

STL MT issues has been resolved in the libstdc++
version distributed with gcc 3.x compiled with
--enable-threads.
In this case defining _PTHREADS not only is
uneccessary, it is very dangerous because it breaks
libstdc++ ABI and will result in strange conflicts when
other modules build without _PTHREADS are loaded in
memory. Defining _PTHREADS also has a detrimental
effect on perfromance.

To quote from libstdc++ FAQ:
"For the sake of this discussion, libstdc++-v3 configures
the SGI STL implementation, not you. This is quite
different from how gcc pre-3.0 worked. In particular, past
advice was for people using g++ to explicitly define
_PTHREADS or other macros or port-specific compilation
options on the command line to get a thread-safe STL.
This is no longer required for any port and should no
longer be done unless you really know what you are
doing and assume all responsibility. "

See the following links for references:
http://gcc.gnu.org/onlinedocs/libstdc++/23_containers/howto.html#3
http://gcc.gnu.org/ml/libstdc++/2001-05/msg00384.html
http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/howto.html#3

Discussion


Log in to post a comment.