This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/24704] __gnu_cxx::__exchange_and_add is called even for single threaded applications



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]