X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/1acdb6e20d63bf8987e6fbcf65e40949831a206d..ec09841c5c348a41ad076a0c5beae57448c1923e:/src/xbt/parmap.cpp diff --git a/src/xbt/parmap.cpp b/src/xbt/parmap.cpp index 67ed936e31..df47a7adee 100644 --- a/src/xbt/parmap.cpp +++ b/src/xbt/parmap.cpp @@ -4,6 +4,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include +#include #include "src/internal_config.h" #if HAVE_UNISTD_H @@ -114,13 +115,12 @@ xbt_parmap_t xbt_parmap_new(unsigned int num_workers, e_xbt_parmap_mode_t mode) xbt_parmap_set_mode(parmap, mode); /* Create the pool of worker threads */ - xbt_parmap_thread_data_t data; parmap->workers[0] = nullptr; #if HAVE_PTHREAD_SETAFFINITY int core_bind = 0; -#endif +#endif for (unsigned int i = 1; i < num_workers; i++) { - data = xbt_new0(s_xbt_parmap_thread_data_t, 1); + xbt_parmap_thread_data_t data = xbt_new0(s_xbt_parmap_thread_data_t, 1); data->parmap = parmap; data->worker_id = i; parmap->workers[i] = xbt_os_thread_create(nullptr, xbt_parmap_worker_main, data, nullptr); @@ -129,7 +129,7 @@ xbt_parmap_t xbt_parmap_new(unsigned int num_workers, e_xbt_parmap_mode_t mode) if (core_bind != xbt_os_get_numcores() - 1) core_bind++; else - core_bind = 0; + core_bind = 0; #endif } return parmap; @@ -141,7 +141,7 @@ xbt_parmap_t xbt_parmap_new(unsigned int num_workers, e_xbt_parmap_mode_t mode) */ void xbt_parmap_destroy(xbt_parmap_t parmap) { - if (!parmap) { + if (not parmap) { return; } @@ -218,6 +218,8 @@ static void xbt_parmap_set_mode(xbt_parmap_t parmap, e_xbt_parmap_mode_t mode) case XBT_PARMAP_DEFAULT: THROW_IMPOSSIBLE; break; + default: + THROW_IMPOSSIBLE; } }