This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/24704] __gnu_cxx::__exchange_and_add is called even for single threaded applications
- From: "bert dot hubert at netherlabs dot nl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Nov 2005 14:26:05 -0000
- Subject: [Bug libstdc++/24704] __gnu_cxx::__exchange_and_add is called even for single threaded applications
- References: <bug-24704-7094@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #17 from bert dot hubert at netherlabs dot nl 2005-11-08 14:26 -------
Subject: Re: __gnu_cxx::__exchange_and_add is called even for single threaded
applications
On Tue, Nov 08, 2005 at 12:06:02PM -0000, pcarlini at suse dot de wrote:
> To repeat: this is needed anyway, because we want to use consistently the
> --thread-model configure option. Nothing will go in not checking also and
> exploting the macro. Then comes everything else... And, sorry, *you* pointed
> out this inconsistency in the first place ;)
True - but would #if __GTHREADS if(__gthread_active_p()) be ok? So check
both?
I've discussed a bit with Momchil Velikov and we feel it might be good if
there were a generic way for an application or library to signal that
multiple threads might be active. Momchil fakes this by defining the pthread
symbol that __gthread_active_p() looks for, but that is not generic enough.
This would enable libstdc++ to turn on its locking or atomic operations, but
remain fast and unlocked for truly single threaded programs.
Thanks.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24704