Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ActorImpl: postpone the on_destroy signal to the destructor
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Thu, 1 Aug 2019 20:41:59 +0000 (22:41 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Thu, 1 Aug 2019 20:42:02 +0000 (22:42 +0200)
This is to prevent that the SMPI extension gets destroyed too early.
The problem is also that this extension is not really an extension but
manually handled, but I'll not fix that tonight.

src/kernel/actor/ActorImpl.cpp

index ab52d77..c31407c 100644 (file)
@@ -59,7 +59,11 @@ ActorImpl::ActorImpl(const simgrid::xbt::string& name, s4u::Host* host) : host_(
   simcall.issuer = this;
 }
 
   simcall.issuer = this;
 }
 
-ActorImpl::~ActorImpl() = default;
+ActorImpl::~ActorImpl() {
+  context_->iwannadie = false; // don't let the simcall's yield() do a Context::stop(), to avoid infinite loops
+  simgrid::simix::simcall([this] { simgrid::s4u::Actor::on_destruction(*ciface()); });
+  context_->iwannadie = true;
+}
 
 /* Become an actor in the simulation
  *
 
 /* Become an actor in the simulation
  *
@@ -178,10 +182,6 @@ void ActorImpl::cleanup()
   }
 
   simix_global->mutex.unlock();
   }
 
   simix_global->mutex.unlock();
-
-  context_->iwannadie = false; // don't let the simcall's yield() do a Context::stop(), to avoid infinite loops
-  simgrid::simix::simcall([this] { simgrid::s4u::Actor::on_destruction(*ciface()); });
-  context_->iwannadie = true;
 }
 
 void ActorImpl::exit()
 }
 
 void ActorImpl::exit()