Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[simix] add intrusive_ptr for mailbox receiver.
authoradfaure <adrien.faure2@gmail.com>
Mon, 4 Jul 2016 08:03:26 +0000 (10:03 +0200)
committeradfaure <adrien.faure2@gmail.com>
Mon, 4 Jul 2016 08:03:26 +0000 (10:03 +0200)
src/s4u/s4u_mailbox.cpp
src/simix/smx_network.cpp
src/simix/smx_network_private.h

index f4c43dc..000f0de 100644 (file)
@@ -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());
 }
 
 }
index 7da114e..bf5aa8b 100644 (file)
@@ -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;
index 6eaa039..9315156 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <deque>
 #include <xbt/base.h>
+#include <boost/intrusive_ptr.hpp>
 
 #include "simgrid/simix.h"
 #include "popping_private.h"
@@ -17,7 +18,7 @@
 typedef struct s_smx_mailbox {
   char *name;
   std::deque<smx_synchro_t> *comm_queue;
-  smx_process_t permanent_receiver; //process which the mailbox is attached to
+  boost::intrusive_ptr<simgrid::simix::Process> permanent_receiver; //process which the mailbox is attached to
   std::deque<smx_synchro_t> *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
-