Description: Compute hardware_concurrency() using get_nprocs() on GLIBC systems
All glibc-based systems have get_nprocs(), which can be used to
implement hardware_concurrency().
This patch fixes a build failure on Debian/kfreebsd.
http://lists.debian.org/debian-bsd/2010/01/msg00036.html
Author: Petr Salinger <Petr.Salinger@seznam.cz>
Forwarded: no
old
|
new
|
|
14 | 14 | #include <boost/thread/once.hpp> |
15 | 15 | #include <boost/thread/tss.hpp> |
16 | 16 | #include <boost/throw_exception.hpp> |
17 | | #ifdef __linux__ |
| 17 | #ifdef __GLIBC__ |
18 | 18 | #include <sys/sysinfo.h> |
19 | 19 | #elif defined(__APPLE__) || defined(__FreeBSD__) |
20 | 20 | #include <sys/types.h> |
… |
… |
|
382 | 382 | #elif defined(BOOST_HAS_UNISTD_H) && defined(_SC_NPROCESSORS_ONLN) |
383 | 383 | int const count=sysconf(_SC_NPROCESSORS_ONLN); |
384 | 384 | return (count>0)?count:0; |
385 | | #elif defined(_GNU_SOURCE) |
| 385 | #elif defined(__GLIBC__) |
386 | 386 | return get_nprocs(); |
387 | 387 | #else |
388 | 388 | return 0; |