implementation of std::thread::hardware_concurrency()

Jonathan Wakely jwakely.gcc@gmail.com
Mon Nov 7 13:46:00 GMT 2011


This provides a working thread::hardware_concurrency on platforms that
support pthread_num_processors_np or the "hw.ncpu" sysctl, but by
testing for the features in configure rather than hardcoding OS macro
tests in thread.cc

        * acinclude.m4 (GLIBCXX_CHECK_SC_NPROC_ONLN): Define.
        (GLIBCXX_CHECK_PTHREADS_NUM_PROCESSORS_NP): Define.
        (GLIBCXX_CHECK_SYSCTL_HW_NCPU): Define.
        * configure.ac: Use new checks.
        * configure: Regenerate.
        * config.h.in: Regenerate.
        * src/thread.cc: Check new config macros.
        * testsuite/lib/libstdc++.exp: Likewise.

Tested x86_64-linux and x86_64-netbsd5.1, committed to trunk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nprocs.patch
Type: text/x-patch
Size: 5460 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20111107/fefce1e5/attachment.bin>


More information about the Libstdc++ mailing list