Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Preserve on_exit funcions between restarts.
[simgrid.git] / src / kernel / actor / ActorImpl.cpp
index 9a646da..99b32d2 100644 (file)
@@ -93,8 +93,7 @@ ActorImplPtr ActorImpl::attach(const std::string& name, void* data, s4u::Host* h
 
   /* 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);
@@ -334,6 +333,7 @@ s4u::Actor* ActorImpl::restart()
   // 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);
 
@@ -487,8 +487,7 @@ ActorImplPtr ActorImpl::create(const std::string& name, const simix::ActorCode&
 
   /* Add properties */
   if (properties != nullptr)
-    for (auto const& kv : *properties)
-      actor->set_property(kv.first, kv.second);
+    actor->set_properties(*properties);
 
   actor->start(code);