X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8d01bd80335f89f2c28cbd1cc00094b5edd8d2de..a539cc1790aed8a1549a6cde5cdddc0876615851:/src/xbt/xbt_os_synchro.cpp diff --git a/src/xbt/xbt_os_synchro.cpp b/src/xbt/xbt_os_synchro.cpp index b78dfdd2ac..d8544dc945 100644 --- a/src/xbt/xbt_os_synchro.cpp +++ b/src/xbt/xbt_os_synchro.cpp @@ -6,9 +6,9 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "simgrid/Exception.hpp" #include "simgrid/simix.h" /* used implementation */ #include "src/kernel/activity/ConditionVariableImpl.hpp" -#include "xbt/ex.hpp" #include "xbt/synchro.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_sync, xbt, "Synchronization mechanism"); @@ -52,28 +52,17 @@ void xbt_cond_wait(xbt_cond_t cond, xbt_mutex_t mutex) int xbt_cond_timedwait(xbt_cond_t cond, xbt_mutex_t mutex, double delay) { - try { - simcall_cond_wait_timeout((smx_cond_t)cond, (smx_mutex_t)mutex, delay); - } catch (xbt_ex& e) { - if (e.category == timeout_error) { - return 1; - } else { - throw; // rethrow the exceptions that I don't know - } - } - return 0; + return simcall_cond_wait_timeout((smx_cond_t)cond, (smx_mutex_t)mutex, delay); } void xbt_cond_signal(xbt_cond_t cond) { - // FIXME: this should use s4u - simgrid::simix::kernelImmediate([cond]() { cond->signal(); }); + cond->cond_.notify_one(); } void xbt_cond_broadcast(xbt_cond_t cond) { - // FIXME: this should use s4u - simgrid::simix::kernelImmediate([cond]() { cond->broadcast(); }); + cond->cond_.notify_all(); } void xbt_cond_destroy(xbt_cond_t cond)