Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Delete ProcessArg.properties.
[simgrid.git] / src / simix / ActorImpl.cpp
index 610678f..29453b1 100644 (file)
@@ -185,7 +185,7 @@ simgrid::s4u::Actor* ActorImpl::restart()
 
   // start the new process
   ActorImpl* actor = simix_global->create_process_function(arg.name.c_str(), std::move(arg.code), arg.data, arg.host,
-                                                           arg.properties, nullptr);
+                                                           arg.properties.get(), nullptr);
   if (arg.kill_time >= 0)
     simcall_process_set_kill_time(actor, arg.kill_time);
   if (arg.auto_restart)
@@ -330,7 +330,7 @@ smx_actor_t SIMIX_process_create(const char* name, std::function<void()> code, v
 
   /* Add properties */
   if (properties != nullptr)
-    for (auto kv : *properties)
+    for (auto const& kv : *properties)
       process->setProperty(kv.first, kv.second);
 
   /* Make sure that the process is initialized for simix, in case we are called from the Host::onCreation signal */
@@ -400,7 +400,7 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn
 
   /* Add properties */
   if (properties != nullptr)
-    for (auto kv : *properties)
+    for (auto const& kv : *properties)
       process->setProperty(kv.first, kv.second);
 
   /* Add the process to it's host process list */
@@ -428,16 +428,10 @@ void SIMIX_process_detach()
   if (not context)
     xbt_die("Not a suitable context");
 
-  simix_global->cleanup_process_function(context->process());
-
-  // Let maestro ignore we are still alive:
-  // xbt_swag_remove(context->process(), simix_global->process_list);
-
-  // TODO, Remove from proces list:
-  //   xbt_swag_remove(process, sg_host_simix(host)->process_list);
-
+  auto process = context->process();
+  simix_global->cleanup_process_function(process);
   context->attach_stop();
-  // delete context;
+  delete process;
 }
 
 /**
@@ -545,9 +539,8 @@ void SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const
 
     simgrid::kernel::activity::ExecImplPtr exec =
         boost::dynamic_pointer_cast<simgrid::kernel::activity::ExecImpl>(process->waiting_synchro);
-    if (exec != nullptr) {
-      SIMIX_execution_cancel(process->waiting_synchro);
-    }
+    if (exec != nullptr && exec->surf_exec)
+      exec->surf_exec->cancel();
 
     simgrid::kernel::activity::CommImplPtr comm =
         boost::dynamic_pointer_cast<simgrid::kernel::activity::CommImpl>(process->waiting_synchro);
@@ -593,7 +586,7 @@ void simcall_HANDLER_process_killall(smx_simcall_t simcall, int reset_pid) {
  */
 void SIMIX_process_killall(smx_actor_t issuer, int reset_pid)
 {
-  for (auto kv : simix_global->process_list)
+  for (auto const& kv : simix_global->process_list)
     if (kv.second != issuer)
       SIMIX_process_kill(kv.second, issuer);
 
@@ -665,7 +658,7 @@ const char* SIMIX_process_self_get_name() {
 
 smx_actor_t SIMIX_process_get_by_name(const char* name)
 {
-  for (auto kv : simix_global->process_list)
+  for (auto const& kv : simix_global->process_list)
     if (kv.second->name == name)
       return kv.second;
   return nullptr;