]> AND Public Git Repository - simgrid.git/blobdiff - src/kernel/activity/ActivityImpl.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove old wait any simcall
[simgrid.git] / src / kernel / activity / ActivityImpl.cpp
index 561853829825a9a299f5ff148eb63329be0eb3f5..2e1de24f10803f4e35ef042e764559b8a39f404b 100644 (file)
@@ -63,23 +63,15 @@ const char* ActivityImpl::get_state_str() const
 
 bool ActivityImpl::test(actor::ActorImpl* issuer)
 {
-  // Associate this simcall to the synchro
-  auto* observer = dynamic_cast<kernel::actor::ActivityTestSimcall*>(issuer->simcall_.observer_);
-  if (observer)
-    register_simcall(&issuer->simcall_);
-
   if (state_ != State::WAITING && state_ != State::RUNNING) {
     finish();
     issuer->exception_ = nullptr; // Do not propagate exception in that case
     return true;
   }
 
-  if (observer) {
+  if (auto* observer = dynamic_cast<kernel::actor::ActivityTestSimcall*>(issuer->simcall_.observer_))
     observer->set_result(false);
-    issuer->waiting_synchro_ = nullptr;
-    unregister_simcall(&issuer->simcall_);
-    issuer->simcall_answer();
-  }
+
   return false;
 }
 
@@ -97,11 +89,9 @@ ssize_t ActivityImpl::test_any(actor::ActorImpl* issuer, const std::vector<Activ
   for (std::size_t i = 0; i < activities.size(); ++i) {
     if (activities[i]->test(issuer)) {
       observer->set_result(i);
-      issuer->simcall_answer();
       return i;
     }
   }
-  issuer->simcall_answer();
   return -1;
 }
 
@@ -121,8 +111,7 @@ void ActivityImpl::wait_for(actor::ActorImpl* issuer, double timeout)
   } else {
     /* we need a sleep action (even when the timeout is infinite) to be notified of host failures */
     /* Comms handle that a bit differently of the other activities */
-    auto* comm = dynamic_cast<CommImpl*>(this);
-    if (comm != nullptr) {
+    if (auto* comm = dynamic_cast<CommImpl*>(this)) {
       resource::Action* sleep = issuer->get_host()->get_cpu()->sleep(timeout);
       sleep->set_activity(comm);
 
@@ -229,7 +218,6 @@ void ActivityImpl::handle_activity_waitany(smx_simcall_t simcall)
     if (not MC_is_active() && not MC_record_replay_is_active()) {
       auto element   = std::find(activities.begin(), activities.end(), this);
       int rank       = element != activities.end() ? static_cast<int>(std::distance(activities.begin(), element)) : -1;
-      auto* observer = dynamic_cast<kernel::actor::ActivityWaitanySimcall*>(simcall->observer_);
       observer->set_result(rank);
     }
   }