CommImpl& CommImpl::detach()
{
detached_ = true;
- EngineImpl::get_instance()->get_maestro()->activities_.emplace_back(this);
+ EngineImpl::get_instance()->get_maestro()->activities_.insert(this);
return *this;
}
other_comm->clean_fun = observer->get_clean_fun();
} else {
other_comm->clean_fun = nullptr;
- observer->get_issuer()->activities_.emplace_back(other_comm);
+ observer->get_issuer()->activities_.insert(other_comm);
}
/* Setup the communication synchro */
other_comm = std::move(this_synchro);
mbox->push(other_comm);
}
- observer->get_issuer()->activities_.emplace_back(other_comm);
+ observer->get_issuer()->activities_.insert(other_comm);
}
} else {
/* Prepare a comm describing us, so that it gets passed to the user-provided filter of other side */
other_comm->set_state(simgrid::kernel::activity::State::READY);
}
- observer->get_issuer()->activities_.emplace_back(other_comm);
+ observer->get_issuer()->activities_.insert(other_comm);
}
observer->set_comm(other_comm.get());
copy_data();
if (detached_)
- EngineImpl::get_instance()->get_maestro()->activities_.remove(this);
+ EngineImpl::get_instance()->get_maestro()->activities_.erase(this);
while (not simcalls_.empty()) {
actor::Simcall* simcall = simcalls_.front();
}
simcall->issuer_->waiting_synchro_ = nullptr;
- simcall->issuer_->activities_.remove(this);
+ simcall->issuer_->activities_.erase(this);
if (detached_) {
if (simcall->issuer_ != dst_actor_ && dst_actor_ != nullptr)
- dst_actor_->activities_.remove(this);
+ dst_actor_->activities_.erase(this);
if (simcall->issuer_ != src_actor_ && src_actor_ != nullptr)
- src_actor_->activities_.remove(this);
+ src_actor_->activities_.erase(this);
}
}
}
actor::ActorImpl* self = actor::ActorImpl::self();
if (self) {
set_actor(self);
- self->activities_.emplace_back(this);
+ self->activities_.insert(this);
}
}
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_);
activity->set_state(activity::State::FAILED);
activity->post();
- activities_.remove(waiting_synchro_);
+ activities_.erase(waiting_synchro_);
waiting_synchro_ = nullptr;
}
for (auto const& activity : activities_)
/* cancel the blocking synchro if any */
if (waiting_synchro_) {
waiting_synchro_->cancel();
- activities_.remove(waiting_synchro_);
+ activities_.erase(waiting_synchro_);
waiting_synchro_ = nullptr;
}
}
#include <functional>
#include <list>
#include <map>
+#include <set>
+#include <unordered_set>
#include <memory>
namespace simgrid::kernel::actor {
bool suspended_ = false;
activity::ActivityImplPtr waiting_synchro_ = nullptr; /* the current blocking synchro if any */
- std::list<activity::ActivityImplPtr> activities_; /* the current non-blocking synchros */
+ std::set<activity::ActivityImplPtr> activities_; /* the current non-blocking synchros */
Simcall simcall_;
/* list of functions executed when the actor dies */
std::shared_ptr<std::vector<std::function<void(bool)>>> on_exit =