X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7e6a623d771b9ef0f6e3f893ba9213154d07bc54..bb90f02025de07b7f6b3e319114764303010562e:/src/xbt/parmap.c diff --git a/src/xbt/parmap.c b/src/xbt/parmap.c index 103fe7fddf..6e0a7286ac 100644 --- a/src/xbt/parmap.c +++ b/src/xbt/parmap.c @@ -3,7 +3,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "gras_config.h" +#include "internal_config.h" #include #ifndef _XBT_WIN32 @@ -347,7 +347,7 @@ static void xbt_parmap_posix_worker_wait(xbt_parmap_t parmap, unsigned round) { xbt_os_mutex_acquire(parmap->ready_mutex); /* wait for more work */ - if (parmap->work < round) { + if (parmap->work != round) { xbt_os_cond_wait(parmap->ready_cond, parmap->ready_mutex); } xbt_os_mutex_release(parmap->ready_mutex); @@ -416,8 +416,10 @@ static void xbt_parmap_futex_worker_wait(xbt_parmap_t parmap, unsigned round) { unsigned work = parmap->work; /* wait for more work */ - if (work < round) + while (work != round) { futex_wait(&parmap->work, work); + work = parmap->work; + } } #endif @@ -472,7 +474,7 @@ static void xbt_parmap_busy_master_signal(xbt_parmap_t parmap) static void xbt_parmap_busy_worker_wait(xbt_parmap_t parmap, unsigned round) { /* wait for more work */ - while (parmap->work < round) { + while (parmap->work != round) { xbt_os_thread_yield(); } } @@ -482,7 +484,7 @@ static void xbt_parmap_busy_worker_wait(xbt_parmap_t parmap, unsigned round) #include "xbt/ex.h" #include "xbt/xbt_os_thread.h" #include "xbt/xbt_os_time.h" -#include "gras_config.h" /* HAVE_FUTEX_H */ +#include "internal_config.h" /* HAVE_FUTEX_H */ XBT_TEST_SUITE("parmap", "Parallel Map"); XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(xbt_parmap_unit);