X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/8dcf0a5124133d036f79094a9b0f26bd4cde9aef..250c00b20a41a9ebb1d1039eaa4ec96f9fa4eb7b:/synchro.h?ds=inline diff --git a/synchro.h b/synchro.h index fed9e87..07897e0 100644 --- a/synchro.h +++ b/synchro.h @@ -1,7 +1,8 @@ #ifndef SYNCHRO_H #define SYNCHRO_H -#include +#include +#include class mutex_t { public: @@ -24,14 +25,12 @@ 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 { + try { xbt_cond_timedwait(cond, mutex.mutex, delay); } - CATCH (e) { + catch (const xbt_ex& e) { if (e.category != timeout_error) - RETHROW; - xbt_ex_free(e); + throw; mutex.acquire(); return false; // got a timeout }