Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Don't build useless temporary object (sonar, c++17).
[simgrid.git] / src / kernel / context / Context.cpp
index 627eb36..875f78d 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "mc/mc.h"
 
+#include "simgrid/Exception.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "src/kernel/activity/CommImpl.hpp"
 #include "src/kernel/context/Context.hpp"
@@ -18,7 +19,8 @@ namespace simgrid {
 namespace kernel {
 namespace context {
 
-ContextFactoryInitializer factory_initializer = nullptr;
+std::function<ContextFactory*(void)> ContextFactory::initializer;
+
 static e_xbt_parmap_mode_t parallel_synchronization_mode = XBT_PARMAP_DEFAULT;
 static int parallel_contexts                             = 1;
 unsigned stack_size;
@@ -139,12 +141,7 @@ Context::~Context()
 void Context::stop()
 {
   this->actor_->cleanup_from_self();
-}
-
-void Context::set_wannadie(bool value)
-{
-  XBT_DEBUG("Actor %s gonna die.", actor_->get_cname());
-  iwannadie_ = value;
+  throw ForcefulKillException(); // clean RAII variables with the dedicated exception
 }
 AttachContext::~AttachContext() = default;