X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3a1ea70a418f393ca1677074e928c664022295bd..7d28d93b90eedd2a49da8b9b990296669e46d05c:/src/include/xbt/parmap.hpp diff --git a/src/include/xbt/parmap.hpp b/src/include/xbt/parmap.hpp index ac909e78dd..bc3b9f6e78 100644 --- a/src/include/xbt/parmap.hpp +++ b/src/include/xbt/parmap.hpp @@ -322,10 +322,8 @@ template void Parmap::PosixSynchro::master_signal() template void Parmap::PosixSynchro::master_wait() { std::unique_lock lk(done_mutex); - while (this->parmap.thread_counter < this->parmap.num_workers) { - /* wait for all workers to be ready */ - done_cond.wait(lk); - } + /* wait for all workers to be ready */ + done_cond.wait(lk, [this]() { return this->parmap.thread_counter >= this->parmap.num_workers; }); } template void Parmap::PosixSynchro::worker_signal() @@ -342,9 +340,7 @@ template void Parmap::PosixSynchro::worker_wait(unsigned round) { std::unique_lock lk(ready_mutex); /* wait for more work */ - while (this->parmap.work_round != round) { - ready_cond.wait(lk); - } + ready_cond.wait(lk, [this, round]() { return this->parmap.work_round == round; }); } #if HAVE_FUTEX_H