Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Typos.
[simgrid.git] / src / s4u / s4u_Comm.cpp
index f348f6885a9dd4fe7c27f9231e0e9780c9cec00e..914138569f08e95d3b959708459b0eb96dd12e3f 100644 (file)
@@ -138,6 +138,10 @@ Comm* Comm::start()
   } else {
     xbt_die("Cannot start a communication before specifying whether we are the sender or the receiver");
   }
+
+  if (suspended_)
+    pimpl_->suspend();
+
   state_ = State::STARTED;
   return this;
 }
@@ -249,7 +253,10 @@ Mailbox* Comm::get_mailbox() const
 
 Actor* Comm::get_sender() const
 {
-  return sender_ ? sender_->ciface() : nullptr;
+  kernel::actor::ActorImplPtr sender = nullptr;
+  if (pimpl_)
+    sender = boost::static_pointer_cast<kernel::activity::CommImpl>(pimpl_)->src_actor_;
+  return sender ? sender->ciface() : nullptr;
 }
 
 } // namespace s4u
@@ -257,9 +264,13 @@ Actor* Comm::get_sender() const
 /* **************************** Public C interface *************************** */
 void sg_comm_detach(sg_comm_t comm, void (*clean_function)(void*))
 {
-  comm = comm->detach(clean_function);
+  comm->detach(clean_function);
+  comm->unref();
+}
+void sg_comm_unref(sg_comm_t comm)
+{
+  comm->unref();
 }
-
 int sg_comm_test(sg_comm_t comm)
 {
   bool finished = comm->test();