Ticket #6100: kfreebsd-thread.patch

File kfreebsd-thread.patch, 1020 bytes (added by smr@…, 11 years ago)
  • libs/thread/src/pthread/thread.cpp

    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  
    1414#include <boost/thread/once.hpp>
    1515#include <boost/thread/tss.hpp>
    1616#include <boost/throw_exception.hpp>
    17 #ifdef __linux__
     17#ifdef __GLIBC__
    1818#include <sys/sysinfo.h>
    1919#elif defined(__APPLE__) || defined(__FreeBSD__)
    2020#include <sys/types.h>
     
    382382#elif defined(BOOST_HAS_UNISTD_H) && defined(_SC_NPROCESSORS_ONLN)
    383383        int const count=sysconf(_SC_NPROCESSORS_ONLN);
    384384        return (count>0)?count:0;
    385 #elif defined(_GNU_SOURCE)
     385#elif defined(__GLIBC__)
    386386        return get_nprocs();
    387387#else
    388388        return 0;