From 59c7075d297be4567fc967eca7c34f8f937f567c Mon Sep 17 00:00:00 2001 From: adfaure Date: Mon, 4 Jul 2016 10:03:26 +0200 Subject: [PATCH] [simix] add intrusive_ptr for mailbox receiver. --- src/s4u/s4u_mailbox.cpp | 2 +- src/simix/smx_network.cpp | 2 +- src/simix/smx_network_private.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/s4u/s4u_mailbox.cpp b/src/s4u/s4u_mailbox.cpp index f4c43dcfa0..000f0dea18 100644 --- a/src/s4u/s4u_mailbox.cpp +++ b/src/s4u/s4u_mailbox.cpp @@ -50,7 +50,7 @@ void Mailbox::setReceiver(Actor actor) { } /** @brief get the receiver (process associated to the mailbox) */ Actor Mailbox::receiver() { - return Actor(pimpl_->permanent_receiver); + return Actor(pimpl_->permanent_receiver.get()); } } diff --git a/src/simix/smx_network.cpp b/src/simix/smx_network.cpp index 7da114eba2..bf5aa8b8c1 100644 --- a/src/simix/smx_network.cpp +++ b/src/simix/smx_network.cpp @@ -198,7 +198,7 @@ XBT_PRIVATE smx_synchro_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_ if (mbox->permanent_receiver!=nullptr){ //this mailbox is for small messages, which have to be sent right now other_synchro->state = SIMIX_READY; - other_comm->dst_proc=mbox->permanent_receiver; + other_comm->dst_proc=mbox->permanent_receiver.get(); other_comm->ref(); mbox->done_comm_queue->push_back(other_synchro); other_comm->mbox=mbox; diff --git a/src/simix/smx_network_private.h b/src/simix/smx_network_private.h index 6eaa039956..9315156a66 100644 --- a/src/simix/smx_network_private.h +++ b/src/simix/smx_network_private.h @@ -9,6 +9,7 @@ #include #include +#include #include "simgrid/simix.h" #include "popping_private.h" @@ -17,7 +18,7 @@ typedef struct s_smx_mailbox { char *name; std::deque *comm_queue; - smx_process_t permanent_receiver; //process which the mailbox is attached to + boost::intrusive_ptr permanent_receiver; //process which the mailbox is attached to std::deque *done_comm_queue;//messages already received in the permanent receive mode } s_smx_mailbox_t; @@ -37,4 +38,3 @@ XBT_PRIVATE smx_synchro_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_mailbox_ int tag, int (*match_fun)(void *, void *, smx_synchro_t), void *data); #endif - -- 2.20.1