From: Martin Quinson Date: Wed, 16 Jan 2019 07:29:38 +0000 (+0100) Subject: Linux and FreeBSD don't agree on the type name, bummers X-Git-Tag: v3_22~549 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3f751bc729c137138174208b9b296879c9b43807 Linux and FreeBSD don't agree on the type name, bummers --- diff --git a/src/include/xbt/parmap.hpp b/src/include/xbt/parmap.hpp index f2360eb4d3..b82c126914 100644 --- a/src/include/xbt/parmap.hpp +++ b/src/include/xbt/parmap.hpp @@ -176,11 +176,17 @@ template Parmap::Parmap(unsigned num_workers, e_xbt_parmap_mode_ /* Bind the worker to a core if possible */ #if HAVE_PTHREAD_SETAFFINITY - pthread_t pthread = this->workers[i]->native_handle(); +#if HAVE_PTHREAD_NP_H /* FreeBSD ? */ + cpuset_t cpuset; + size_t size = sizeof(cpuset_t); +#else /* Linux ? */ cpu_set_t cpuset; + size_t size = sizeof(cpu_set_t); +#endif + pthread_t pthread = this->workers[i]->native_handle(); CPU_ZERO(&cpuset); CPU_SET(core_bind, &cpuset); - pthread_setaffinity_np(pthread, sizeof(cpu_set_t), &cpuset); + pthread_setaffinity_np(pthread, size, &cpuset); if (core_bind != std::thread::hardware_concurrency() - 1) core_bind++; else