libstdc++ wants clock_gettime without libpthread
Jonathan Wakely
jwakely.gcc@gmail.com
Thu Oct 18 20:10:00 GMT 2012
Hi,
libstdc++ can be configured to use clock_gettime to implement a
high-resolution C++11 std::chrono::system_clock.
But using clock_gettime() requires libstdc++.so to link to librt.so
which also pulls in libpthread.so, which causes GCC's
__gthread_active_p() function to report the program is multithreaded,
causing libstdc++'s reference counting to use atomic ops.
This means that when configuring libstdc++ you have to choose between
a low-resolution clock or a performance penalty for single-threaded
C++ programs.
Is there any possibility glibc could be changed so we could use
clock_gettime() without causing a dependency on libpthread.so?
More information about the Libc-alpha
mailing list