X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/324204969dba501413a9f62de983806a6fddd6a0..refs/heads/master:/synchro.h?ds=sidebyside diff --git a/synchro.h b/synchro.h index fed9e87..bd49783 100644 --- a/synchro.h +++ b/synchro.h @@ -1,7 +1,7 @@ #ifndef SYNCHRO_H #define SYNCHRO_H -#include +#include class mutex_t { public: @@ -24,14 +24,7 @@ public: void signal() { xbt_cond_signal(cond); } void wait(mutex_t& mutex) { xbt_cond_wait(cond, mutex.mutex); } bool timedwait(mutex_t& mutex, double delay) { - xbt_ex_t e; - TRY { - xbt_cond_timedwait(cond, mutex.mutex, delay); - } - CATCH (e) { - if (e.category != timeout_error) - RETHROW; - xbt_ex_free(e); + if (xbt_cond_timedwait(cond, mutex.mutex, delay)) { mutex.acquire(); return false; // got a timeout }