Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
obey our coding conventions in ActorImpl::mailboxes, and free them once only
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 12 Mar 2022 12:16:06 +0000 (13:16 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 12 Mar 2022 12:16:06 +0000 (13:16 +0100)
src/kernel/activity/MailboxImpl.cpp
src/kernel/actor/ActorImpl.cpp
src/kernel/actor/ActorImpl.hpp

index cafb036..a2620a3 100644 (file)
@@ -32,7 +32,7 @@ MailboxImpl::~MailboxImpl()
 void MailboxImpl::set_receiver(s4u::ActorPtr actor)
 {
   if (this->permanent_receiver_) {
-    std::vector<MailboxImpl*>& mboxes = this->permanent_receiver_->mailboxes;
+    std::vector<MailboxImpl*>& mboxes = this->permanent_receiver_->mailboxes_;
     mboxes.erase(std::remove(mboxes.begin(), mboxes.end(), this), mboxes.end());
   }
 
index 67c9d55..e1af046 100644 (file)
@@ -157,8 +157,8 @@ void ActorImpl::cleanup_from_kernel()
 
   undaemonize();
 
-  while (not mailboxes.empty())
-    mailboxes.back()->set_receiver(nullptr);
+  while (not mailboxes_.empty())
+    mailboxes_.back()->set_receiver(nullptr);
 }
 
 /* Do all the cleanups from the actor context. Warning, the simcall mechanism was not reignited so doing simcalls in
@@ -218,9 +218,6 @@ void ActorImpl::exit()
     activity->cancel();
   activities_.clear();
 
-  while (not mailboxes.empty())
-    mailboxes.back()->set_receiver(nullptr);
-
   // Forcefully kill the actor if its host is turned off. Not a HostFailureException because you should not survive that
   this->throw_exception(std::make_exception_ptr(ForcefulKillException(host_->is_on() ? "exited" : "host failed")));
 }
index 1bf5803..0dc8751 100644 (file)
@@ -41,7 +41,7 @@ class XBT_PUBLIC ActorImpl : public xbt::PropertyHolder, public ActorRestartingT
   bool daemon_       = false; /* Daemon actors are automatically killed when the last non-daemon leaves */
   unsigned stacksize_; // set to default value in constructor
 
-  std::vector<activity::MailboxImpl*> mailboxes;
+  std::vector<activity::MailboxImpl*> mailboxes_;
   friend activity::MailboxImpl;
 
 public: