/* Add properties */
if (properties != nullptr)
- for (auto const& kv : *properties)
- actor->set_property(kv.first, kv.second);
+ actor->set_properties(*properties);
/* Add the process to it's host process list */
host->pimpl_->process_list_.push_back(*actor);
// Execute the termination callbacks
bool failed = context_->iwannadie;
- while (not on_exit.empty()) {
- auto exit_fun = on_exit.back();
- on_exit.pop_back();
- exit_fun(failed);
- }
+ for (auto exit_fun = on_exit->crbegin(); exit_fun != on_exit->crend(); ++exit_fun)
+ (*exit_fun)(failed);
+ if (not has_to_auto_restart())
+ on_exit->clear();
/* cancel non-blocking activities */
for (auto activity : comms)
// start the new actor
ActorImplPtr actor =
ActorImpl::create(arg.name, std::move(arg.code), arg.data, arg.host, arg.properties.get(), nullptr);
+ *actor->on_exit = std::move(*arg.on_exit);
actor->set_kill_time(arg.kill_time);
actor->set_auto_restart(arg.auto_restart);
/* Add properties */
if (properties != nullptr)
- for (auto const& kv : *properties)
- actor->set_property(kv.first, kv.second);
+ actor->set_properties(*properties);
actor->start(code);
void SIMIX_process_on_exit(smx_actor_t actor, const std::function<void(bool /*failed*/)>& fun)
{
xbt_assert(actor, "current process not found: are you in maestro context ?");
- actor->on_exit.emplace_back(fun);
+ actor->on_exit->emplace_back(fun);
}
/** @brief Restart a process, starting it again from the beginning. */