Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Replaced std::list by std::set to keep track of activities
[simgrid.git] / src / kernel / activity / ExecImpl.cpp
index 503e2c5..dc83190 100644 (file)
@@ -25,7 +25,7 @@ ExecImpl::ExecImpl()
   actor::ActorImpl* self = actor::ActorImpl::self();
   if (self) {
     set_actor(self);
-    self->activities_.emplace_back(this);
+    self->activities_.insert(this);
   }
 }
 
@@ -145,8 +145,8 @@ ExecImpl& ExecImpl::update_sharing_penalty(double sharing_penalty)
 void ExecImpl::post()
 {
   xbt_assert(surf_action_ != nullptr);
-  auto const& hosts = get_hosts();
-  if (std::any_of(hosts.begin(), hosts.end(), [](const s4u::Host* host) { return not host->is_on(); })) {
+  if (auto const& hosts = get_hosts();
+      std::any_of(hosts.begin(), hosts.end(), [](const s4u::Host* host) { return not host->is_on(); })) {
     /* If one of the hosts running the synchro failed, notice it. This way, the asking
      * process can be killed if it runs on that host itself */
     set_state(State::FAILED);
@@ -167,7 +167,7 @@ void ExecImpl::post()
   clean_action();
   timeout_detector_.reset();
   if (get_actor() != nullptr) {
-    get_actor()->activities_.remove(this);
+    get_actor()->activities_.erase(this);
   }
   if (get_state() != State::FAILED && cb_id_ >= 0)
     s4u::Host::on_state_change.disconnect(cb_id_);