Improving --enable-libstdcxx-time

Paolo Carlini
Wed May 30 08:40:00 GMT 2012


On 05/28/2012 08:11 PM, Jonathan Wakely wrote:
> We need to do something about the fact that this_thread::yield() and
> this_thread::sleep_for() are only defined when GCC is built with
> --enable-libstdcxx-time, which most users and distros don't do.
> Currently the option defaults to no, which means we don't even try to
> use clock_gettime, nanosleep and sched_yield even though they may be
> available. The reason is that some or all of those calls are defined
> in librt, but on GNU/Linux if links to then it
> also links to and so __gthread_active_p() will always
> return true, causing additional locking in single-threaded apps.
Did we consider raising this issue in the glibc mailing lists? Now that 
the project is managed in a different, more open, way, maybe we can make 
progress, I don't think things are set in stone and, if nothing else, 
the C++11 library needs appear to require some changes in this area. 
Then, I'm certainly in favor of any strategy improving our configury, 
like supporting more features by default when we know it's safe, etc.

Thanks for looking into this!


More information about the Libstdc++ mailing list