Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
CommWaitTransition mailbox is now valid
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 11 Feb 2022 23:13:47 +0000 (00:13 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 11 Feb 2022 23:13:47 +0000 (00:13 +0100)
src/kernel/activity/CommImpl.cpp
src/kernel/activity/CommImpl.hpp
src/kernel/actor/SimcallObserver.cpp

index 8e61933..9a6579c 100644 (file)
@@ -128,6 +128,8 @@ CommImpl& CommImpl::set_rate(double rate)
 }
 CommImpl& CommImpl::set_mailbox(MailboxImpl* mbox)
 {
+  if (mbox != nullptr)
+    mbox_id_ = mbox->get_id();
   mbox_ = mbox;
   return *this;
 }
index 8e5ea13..3837b6b 100644 (file)
@@ -24,7 +24,9 @@ class XBT_PUBLIC CommImpl : public ActivityImpl_T<CommImpl> {
   double size_       = 0.0;
   bool detached_     = false;   /* If detached or not */
   bool copied_       = false;   /* whether the data were already copied */
-  MailboxImpl* mbox_ = nullptr; /* Rendez-vous where the comm is queued */
+  MailboxImpl* mbox_ = nullptr; /* Rendez-vous where the comm is queued. nullptr once the comm is matched with both a
+                                   sender and receiver */
+  long mbox_id_      = -1;      /* ID of the rendez-vous where the comm was first queued (for MC) */
   s4u::Host* from_   = nullptr; /* Pre-determined only for direct host-to-host communications */
   s4u::Host* to_     = nullptr; /* Otherwise, computed at start() time from the actors */
 
@@ -45,6 +47,7 @@ public:
 
   double get_rate() const { return rate_; }
   MailboxImpl* get_mailbox() const { return mbox_; }
+  long get_mailbox_id() const { return mbox_id_; }
   bool detached() const { return detached_; }
 
   std::vector<s4u::Link*> get_traversed_links() const;
index 9a479e9..8a9287c 100644 (file)
@@ -235,7 +235,7 @@ void ActivityWaitSimcall::serialize(Simcall& type, char* buffer)
     stream << (timeout_ > 0) << ' ' << comm;
     stream << ' ' << (comm->src_actor_ != nullptr ? comm->src_actor_->get_pid() : -1);
     stream << ' ' << (comm->dst_actor_ != nullptr ? comm->dst_actor_->get_pid() : -1);
-    stream << ' ' << (comm->get_mailbox() != nullptr ? comm->get_mailbox()->get_id() : 666);
+    stream << ' ' << comm->get_mailbox_id();
     stream << ' ' << (void*)comm->src_buff_ << ' ' << (void*)comm->dst_buff_ << ' ' << comm->src_buff_size_;
     strcpy(buffer, stream.str().c_str());
   } else {