>I have just tested out the following:
>
>CHECK_FUNCTION_EXISTS(pthread_setaffinity_np HAVE_PTHREAD_SETAFFINITY_NP)
>IF(HAVE_PTHREAD_SETAFFINITY_NP)
> # double check that pthread_setaffinity_np is available as FreeBSD
>header doesn't contain required function
> CHECK_CXX_SOURCE_COMPILES("
> #include <pthread.h>
> int main() {
> cpu_set_t cpumask;
> CPU_ZERO( &cpumask );
> CPU_SET( 0, &cpumask );
> pthread_setaffinity_np( pthread_self(), sizeof(cpumask), &cpumask);
> return 0;
> }" COMPILES_PTHREAD_SETAFFINITY_NP)
>
> IF (NOT COMPILES_PTHREAD_SETAFFINITY_NP)
> SET(HAVE_PTHREAD_SETAFFINITY_NP OFF)
> ENDIF()
>ENDIF()
Hi Robert,
Yes, testing the compiling of GNU/_np functions
is a better general solution.
Or another way is to use the C preprocessor instead.
In PThread.c++, instead test __USE_GNU:
< #if defined(HAVE_PTHREAD_SETAFFINITY_NP)
> #if defined(__USE_GNU)
pthread_setaffinity_np( pthread_self(), sizeof(cpumask), &cpumask);
Assuming pthread_setaffinity_np() is indeed a GNU-only extension
(your solution might be more universal).
--
Jim Brooks
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org