implementation of std::thread::hardware_concurrency()
Iain Sandoe
developer@sandoe-acoustics.co.uk
Mon Nov 7 14:11:00 GMT 2011
On 7 Nov 2011, at 13:45, Jonathan Wakely wrote:
> 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
if the system supports run-time User-controllable core-count then this
will not account for that.
>
> * 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
> <nprocs.patch>
More information about the Libstdc++
mailing list