[Bug libstdc++/24704] __gnu_cxx::__exchange_and_add is called even for single threaded applications
pcarlini at suse dot de
gcc-bugzilla@gcc.gnu.org
Tue Nov 8 11:50:00 GMT 2005
------- Comment #14 from pcarlini at suse dot de 2005-11-08 11:50 -------
(In reply to comment #13)
> Indeed, other parts of libstdc++ already rely on __gthread_active_p().
Sure, see mt_alloc: there is an external __GTHREADS and an internal
__gthread_active_p().
> Using __GTHREADS would get us halfway, but nobody in his right mind
> (certainly no distributor) is going to compile with --enable-threads=single
> on a platform that does posix - you get a crippled compiler. I'd hate to
> have to keep two compilers around.
This is meaningless. The configure option is present and has to be used
consistently in the whole library. Again, see mt_alloc.
> I've verified that adding a check on __gthread_active_p() to
> bits/basic_string.h does the right thing. It only does so after a complete
> recompile of libstdc++ though, the code is indeed instantiated earlier (as
> you mentioned already).
Of course does the right thing, there is no doubt about this. But, again,
it's inconsistent and ugly adding conditionals all around only in basic_string
and not touching all the other places. We simply want to do the same thing
that mt_alloc is already doing, centralized in one place.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24704
More information about the Gcc-bugs
mailing list