Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Improve the behavior of wait_for(0), and activate some tests
[simgrid.git] / src / kernel / activity / ActivityImpl.cpp
index def6d95..6c26b63 100644 (file)
@@ -80,8 +80,12 @@ void ActivityImpl::wait_for(actor::ActorImpl* issuer, double timeout)
   /* If the synchro is already finished then perform the error handling */
   if (state_ != simgrid::kernel::activity::State::RUNNING)
     finish();
-  else {
-    /* we need a sleep action (even when there is no timeout) to be notified of host failures */
+  else if (timeout == 0.) {
+    // still running and timeout == 0 ? We need to report a timeout
+    state_ = simgrid::kernel::activity::State::TIMEOUT;
+    finish();
+  } else {
+    /* we need a sleep action (even when the timeout is infinite) to be notified of host failures */
     set_timeout(timeout);
   }
 }