Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Implement thread factory with std::thread, and cleanups
[simgrid.git] / src / simix / ActorImpl.cpp
index f9bc844..06e64af 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -23,7 +23,7 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_process, simix, "Logging specific to SIMIX (process)");
 
-unsigned long simix_process_maxpid = 0;
+static unsigned long simix_process_maxpid = 0;
 
 /**
  * @brief Returns the current agent.
@@ -369,9 +369,8 @@ smx_actor_t SIMIX_process_create(std::string name, simgrid::simix::ActorCode cod
   simix_global->process_to_run.push_back(process);
   intrusive_ptr_add_ref(process);
 
-  /* The onCreation() signal must be delayed until there, where the pid and everything is set */
-  simgrid::s4u::ActorPtr tmp = process->iface(); // Passing this directly to onCreation will lead to crashes
-  simgrid::s4u::Actor::on_creation(tmp);
+  /* The on_creation() signal must be delayed until there, where the pid and everything is set */
+  simgrid::s4u::Actor::on_creation(process->iface());
 
   return process;
 }
@@ -472,8 +471,8 @@ void SIMIX_process_kill(smx_actor_t actor, smx_actor_t issuer)
     return;
   }
 
-  XBT_DEBUG("Actor '%s'@%s is killing actor '%s'@%s", issuer->get_cname(),
-            (issuer->host_ == nullptr ? "(null)" : issuer->host_->get_cname()), actor->get_cname(),
+  XBT_DEBUG("Actor '%s'@%s is killing actor '%s'@%s", issuer == nullptr ? "(null)" : issuer->get_cname(),
+            (issuer == nullptr || issuer->host_ == nullptr ? "(null)" : issuer->host_->get_cname()), actor->get_cname(),
             actor->host_->get_cname());
 
   actor->context_->iwannadie = true;
@@ -504,7 +503,7 @@ void SIMIX_process_kill(smx_actor_t actor, smx_actor_t issuer)
      */
 
     if (simgrid::kernel::context::factory_initializer == nullptr) // Only Java sets a factory_initializer, for now
-      actor->throw_exception(std::make_exception_ptr(simgrid::kernel::context::Context::StopRequest("Host failed")));
+      actor->throw_exception(std::make_exception_ptr(simgrid::kernel::context::Context::StopRequest("host failed")));
   }
 
   /* destroy the blocking synchro if any */