From d18416a04b075e719e3860a11292b6ac98546949 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Fri, 4 Jan 2019 22:41:00 +0100 Subject: [PATCH 1/1] tiny simplification: xbt_os_thread_bind is a noop when not HAVE_PTHREAD_SETAFFINITY --- src/include/xbt/parmap.hpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/include/xbt/parmap.hpp b/src/include/xbt/parmap.hpp index b8fbed6b5d..f37540bbcb 100644 --- a/src/include/xbt/parmap.hpp +++ b/src/include/xbt/parmap.hpp @@ -165,19 +165,15 @@ template Parmap::Parmap(unsigned num_workers, e_xbt_parmap_mode_ /* Create the pool of worker threads */ this->workers[0] = nullptr; -#if HAVE_PTHREAD_SETAFFINITY - int core_bind = 0; -#endif + unsigned int core_bind = 0; for (unsigned i = 1; i < num_workers; i++) { ThreadData* data = new ThreadData(*this, i); this->workers[i] = xbt_os_thread_create(nullptr, worker_main, data, nullptr); -#if HAVE_PTHREAD_SETAFFINITY xbt_os_thread_bind(this->workers[i], core_bind); - if (core_bind != xbt_os_get_numcores() - 1) + if (core_bind != std::thread::hardware_concurrency() - 1) core_bind++; else core_bind = 0; -#endif } } -- 2.20.1