From f9b13d923d31bb0336aeeaab6d5b7ba33812f3f7 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sat, 12 Feb 2022 00:13:47 +0100 Subject: [PATCH] CommWaitTransition mailbox is now valid --- src/kernel/activity/CommImpl.cpp | 2 ++ src/kernel/activity/CommImpl.hpp | 5 ++++- src/kernel/actor/SimcallObserver.cpp | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/kernel/activity/CommImpl.cpp b/src/kernel/activity/CommImpl.cpp index 8e619335b3..9a6579c12c 100644 --- a/src/kernel/activity/CommImpl.cpp +++ b/src/kernel/activity/CommImpl.cpp @@ -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; } diff --git a/src/kernel/activity/CommImpl.hpp b/src/kernel/activity/CommImpl.hpp index 8e5ea1337a..3837b6b28f 100644 --- a/src/kernel/activity/CommImpl.hpp +++ b/src/kernel/activity/CommImpl.hpp @@ -24,7 +24,9 @@ class XBT_PUBLIC CommImpl : public ActivityImpl_T { 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 get_traversed_links() const; diff --git a/src/kernel/actor/SimcallObserver.cpp b/src/kernel/actor/SimcallObserver.cpp index 9a479e9963..8a9287cc5d 100644 --- a/src/kernel/actor/SimcallObserver.cpp +++ b/src/kernel/actor/SimcallObserver.cpp @@ -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 { -- 2.20.1