X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/3547772c2f2424e6b3f7d4b7414e939947e7c3f4..1d498e972be5597e0f902a1bb8e6ec8d87d51002:/synchro.h diff --git a/synchro.h b/synchro.h index a2e86f3..bd49783 100644 --- a/synchro.h +++ b/synchro.h @@ -23,8 +23,12 @@ public: void broadcast() { xbt_cond_broadcast(cond); } void signal() { xbt_cond_signal(cond); } void wait(mutex_t& mutex) { xbt_cond_wait(cond, mutex.mutex); } - void timedwait(mutex_t& mutex, double delay) { - xbt_cond_timedwait(cond, mutex.mutex, delay); + bool timedwait(mutex_t& mutex, double delay) { + if (xbt_cond_timedwait(cond, mutex.mutex, delay)) { + mutex.acquire(); + return false; // got a timeout + } + return true; } private: