[Boost.Thread] Patch for Intel on Darwin

Hi, The thread library is failing to build with Intel on Darwin with this error. "/opt/intel/Compiler/11.1/067/bin/intel64/icpc" -xc++ -w1 -O0 -g - inline-level=0 -vec-report0 -DBOOST_ALL_NO_LIB=1 - DBOOST_THREAD_BUILD_DLL=1 -DBOOST_THREAD_POSIX -I".." -c -o "/Volumes/ Scratch/kbelco/boost/results/boost/bin.v2/libs/thread/build/intel- darwin-11.1/debug/threading-multi/pthread/thread.o" "../libs/thread/ src/pthread/thread.cpp" ../libs/thread/src/pthread/thread.cpp(385): error: identifier "get_nprocs" is undefined return get_nprocs(); ^ The fix is to test for Apple and Intel before the GNU test. Index: libs/thread/src/pthread/thread.cpp =================================================================== --- libs/thread/src/pthread/thread.cpp (revision 61969) +++ libs/thread/src/pthread/thread.cpp (working copy) @@ -381,6 +381,10 @@ { #if defined(PTW32_VERSION) || defined(__hpux) return pthread_num_processors_np(); +#elif defined(__APPLE__) && defined (__INTEL_COMPILER) + int count; + size_t size=sizeof(count); + return sysctlbyname("hw.ncpu",&count,&size,NULL,0)?0:count; #elif defined(_GNU_SOURCE) return get_nprocs(); #elif defined(__APPLE__) || defined(__FreeBSD__) This has been tested on Darwin and Linux. Okay to commit? -- Noel

"Belcourt, Kenneth" <kbelco@sandia.gov> writes:
The thread library is failing to build with Intel on Darwin with this error.
../libs/thread/src/pthread/thread.cpp(385): error: identifier "get_nprocs" is undefined return get_nprocs(); ^
The fix is to test for Apple and Intel before the GNU test.
Fixed on trunk. Anthony -- Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/ just::thread C++0x thread library http://www.stdthread.co.uk Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976
participants (2)
-
Anthony Williams
-
Belcourt, Kenneth