Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Removed the "state_ != finished" assert in s4u::Comm::wait(...) since
authorhenricasanova <henric@hawaii.edu>
Thu, 6 Jul 2017 07:49:53 +0000 (09:49 +0200)
committerhenricasanova <henric@hawaii.edu>
Thu, 6 Jul 2017 07:49:53 +0000 (09:49 +0200)
waiting on a finished communication should be a feature, not a bug

src/s4u/s4u_comm.cpp

index 070f7d1..9f4ad0b 100644 (file)
@@ -83,7 +83,10 @@ void Comm::start() {
   state_ = started;
 }
 void Comm::wait() {
   state_ = started;
 }
 void Comm::wait() {
-  xbt_assert(state_ == started || state_ == inited);
+  xbt_assert(state_ == started || state_ == inited || state_ == finished);
+
+  if (state_ == finished)
+    return;
 
   if (state_ == started)
     simcall_comm_wait(pimpl_, -1/*timeout*/);
 
   if (state_ == started)
     simcall_comm_wait(pimpl_, -1/*timeout*/);
@@ -103,7 +106,10 @@ void Comm::wait() {
 }
 
 void Comm::wait(double timeout) {
 }
 
 void Comm::wait(double timeout) {
-  xbt_assert(state_ == started || state_ == inited);
+  xbt_assert(state_ == started || state_ == inited || state_ == finished);
+
+  if (state_ == finished)
+    return;
 
   if (state_ == started) {
     simcall_comm_wait(pimpl_, timeout);
 
   if (state_ == started) {
     simcall_comm_wait(pimpl_, timeout);