From: Arnaud Giersch Date: Mon, 30 Apr 2018 19:57:18 +0000 (+0200) Subject: xbt_cond_timedwait has changed and doesn't throw exception anymore. X-Git-Tag: sg_v3_18 X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/commitdiff_plain/41494029236416fcaad7fe8cc67c69a730fc9265?hp=612a491138746843a9fe0df8551e6ccf6ea2cf27 xbt_cond_timedwait has changed and doesn't throw exception anymore. --- diff --git a/simgrid_features.h b/simgrid_features.h index 82c7b23..2cfb227 100644 --- a/simgrid_features.h +++ b/simgrid_features.h @@ -3,8 +3,8 @@ #include -#if !defined(SIMGRID_VERSION) || SIMGRID_VERSION < 31400UL // == SG < 3.14 == // -# error "Unsupported SimGrid version. Need version >= 3.14" +#if !defined(SIMGRID_VERSION) || SIMGRID_VERSION < 31800UL // == SG < 3.18 == // +# error "Unsupported SimGrid version. Need version >= 3.18" #endif // =================================================================== // #endif // !SIMGRID_FEATURES_H diff --git a/synchro.h b/synchro.h index 07897e0..bd49783 100644 --- a/synchro.h +++ b/synchro.h @@ -1,7 +1,6 @@ #ifndef SYNCHRO_H #define SYNCHRO_H -#include #include class mutex_t { @@ -25,12 +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) { - try { - xbt_cond_timedwait(cond, mutex.mutex, delay); - } - catch (const xbt_ex& e) { - if (e.category != timeout_error) - throw; + if (xbt_cond_timedwait(cond, mutex.mutex, delay)) { mutex.acquire(); return false; // got a timeout }