The code in question is:
unsigned thread::hardware_concurrency()
{
#if defined(PTW32_VERSION) || defined(__hpux)
return pthread_num_processors_np();
#elif defined(_GNU_SOURCE)
return get_nprocs();
It seems that get_nprocs() is always implemented by Glibc. Worst-case it'd
be a dummy stub. I'd just try to figure out why <sys/sysinfo.h> is not
included or not providing its declaration.
In addition to what everyone has said, _GNU_SOURCE seems the wrong check
to me, that's a user definition to request the system to expose GNU
extensions, if the code is trying to check for a glibc implementation
it should be using __GLIBC__ instead, or I guess better yet, it should
be checking for the functions availability at build time and use the
best one found.
Please use patch bellow - build tested on kfreebsd-amd64.
Thanks for noticing us about GNU/kFreeBSD specific problem.
Petr
--- libs/thread/src/pthread/thread.cpp~
+++ libs/thread/src/pthread/thread.cpp
@@ -13,7 +13,7 @@
#include <boost/thread/locks.hpp>
#include <boost/thread/once.hpp>
#include <boost/thread/tss.hpp>
-#ifdef __linux__
+#ifdef __GLIBC__
#include <sys/sysinfo.h>
#elif defined(__APPLE__) || defined(__FreeBSD__)
#include <sys/types.h>
@@ -380,7 +380,7 @@
{
#if defined(PTW32_VERSION) || defined(__hpux)
return pthread_num_processors_np();
-#elif defined(_GNU_SOURCE)
+#elif defined(__GLIBC__)
return get_nprocs();
#elif defined(__APPLE__) || defined(__FreeBSD__)
int count;
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]