Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[s4u] Don't handle -1 specially in ConditionVariable::wait_for()
[simgrid.git] / src / s4u / s4u_conditionVariable.cpp
index 3200255..3074f12 100644 (file)
@@ -25,6 +25,10 @@ void ConditionVariable::wait(std::unique_lock<Mutex>& lock) {
 }
 
 std::cv_status s4u::ConditionVariable::wait_for(std::unique_lock<Mutex>& lock, double timeout) {
 }
 
 std::cv_status s4u::ConditionVariable::wait_for(std::unique_lock<Mutex>& lock, double timeout) {
+  // The simcall uses -1 for "any timeout" but we don't want this:
+  if (timeout < 0)
+    timeout = 0.0;
+
   try {
     simcall_cond_wait_timeout(cond_, lock.mutex()->mutex_, timeout);
     return std::cv_status::no_timeout;
   try {
     simcall_cond_wait_timeout(cond_, lock.mutex()->mutex_, timeout);
     return std::cv_status::no_timeout;