From: adfaure Date: Mon, 18 Jul 2016 13:23:52 +0000 (+0200) Subject: [s4u] Mailbox::receiver return a s4u::ActorPtr X-Git-Tag: v3_14~750^2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/458ff11 [s4u] Mailbox::receiver return a s4u::ActorPtr --- diff --git a/include/simgrid/s4u/mailbox.hpp b/include/simgrid/s4u/mailbox.hpp index 4238ecfd02..c4a022c9d6 100644 --- a/include/simgrid/s4u/mailbox.hpp +++ b/include/simgrid/s4u/mailbox.hpp @@ -61,7 +61,7 @@ public: void setReceiver(Actor* process); /** Return the process declared as permanent receiver, or nullptr if none **/ - Actor& receiver(); + ActorPtr receiver(); }; using MailboxPtr = Mailbox::Ptr; diff --git a/src/s4u/s4u_mailbox.cpp b/src/s4u/s4u_mailbox.cpp index d7f48697dc..ed93710d70 100644 --- a/src/s4u/s4u_mailbox.cpp +++ b/src/s4u/s4u_mailbox.cpp @@ -43,8 +43,9 @@ void Mailbox::setReceiver(Actor* actor) { } /** @brief get the receiver (process associated to the mailbox) */ -Actor& Mailbox::receiver() { - return pimpl_->permanent_receiver->actor(); +ActorPtr Mailbox::receiver() { + if(pimpl_->permanent_receiver == nullptr) return ActorPtr(); + return ActorPtr(&pimpl_->permanent_receiver->actor()); } } @@ -62,5 +63,5 @@ void sg_mbox_setReceiver(sg_mbox_t mbox, smx_process_t process) { mbox->setReceiver(&process->actor()); } smx_process_t sg_mbox_receiver(sg_mbox_t mbox) { - return mbox->receiver().getInferior(); + return mbox->receiver()->getInferior(); }