From 423d3ad610d6a1e0587b42fd7d2a7a9959af778d Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 6 Jul 2017 10:21:23 +0200 Subject: [PATCH] implement getter s4u::Comm::mailbox() --- include/simgrid/s4u/Comm.hpp | 3 +++ src/s4u/s4u_comm.cpp | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/simgrid/s4u/Comm.hpp b/include/simgrid/s4u/Comm.hpp index 16682aa91c..a2c71d0a47 100644 --- a/include/simgrid/s4u/Comm.hpp +++ b/include/simgrid/s4u/Comm.hpp @@ -112,6 +112,9 @@ public: bool test(); void cancel(); + /** Retrieve the mailbox on which this comm acts */ + MailboxPtr mailbox(); + private: double rate_ = -1; void* dstBuff_ = nullptr; diff --git a/src/s4u/s4u_comm.cpp b/src/s4u/s4u_comm.cpp index 9f4ad0b438..95a5a8712d 100644 --- a/src/s4u/s4u_comm.cpp +++ b/src/s4u/s4u_comm.cpp @@ -146,7 +146,8 @@ void Comm::cancel() commPimpl->cancel(); } -bool Comm::test() { +bool Comm::test() +{ xbt_assert(state_ == inited || state_ == started || state_ == finished); if (state_ == finished) { @@ -164,6 +165,11 @@ bool Comm::test() { return false; } +MailboxPtr Comm::mailbox() +{ + return mailbox_; +} + void intrusive_ptr_release(simgrid::s4u::Comm* c) { if (c->refcount_.fetch_sub(1, std::memory_order_release) == 1) { -- 2.20.1