Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
various cleanups in actors/processes
[simgrid.git] / src / simix / smx_network.cpp
index 2dcabbc1dee341234c40df33158817fab7a2d9a4..151a5772fa81b83c3a2e2390e121be12f258387a 100644 (file)
@@ -58,7 +58,7 @@ _find_matching_comm(boost::circular_buffer_space_optimized<smx_activity_t>* dequ
       comm->mbox_cpy = comm->mbox;
 #endif
       comm->mbox = nullptr;
-      return std::move(comm);
+      return comm;
     }
     XBT_DEBUG("Sorry, communication synchro %p does not match our needs:"
               " its type is %d but we are looking for a comm of type %d (or maybe the filtering didn't match)",
@@ -188,13 +188,13 @@ SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t mbox, void* dst_buff, size_
 
     XBT_DEBUG("We have a comm that has probably already been received, trying to match it, to skip the communication");
     //find a match in the list of already received comms
-    other_comm = std::move(_find_matching_comm(&mbox->done_comm_queue, SIMIX_COMM_SEND, match_fun, data, this_synchro,
-                                               /*remove_matching*/ true));
+    other_comm = _find_matching_comm(&mbox->done_comm_queue, SIMIX_COMM_SEND, match_fun, data, this_synchro,
+                                     /*remove_matching*/ true);
     //if not found, assume the receiver came first, register it to the mailbox in the classical way
     if (not other_comm) {
       XBT_DEBUG("We have messages in the permanent receive list, but not the one we are looking for, pushing request into list");
-      other_comm = this_synchro;
-      mbox->push(this_synchro);
+      other_comm = std::move(this_synchro);
+      mbox->push(other_comm);
     } else {
       if (other_comm->surf_comm && other_comm->remains() < 1e-12) {
         XBT_DEBUG("comm %p has been already sent, and is finished, destroy it", other_comm.get());
@@ -215,8 +215,8 @@ SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t mbox, void* dst_buff, size_
 
     if (other_comm == nullptr) {
       XBT_DEBUG("Receive pushed first (%zu comm enqueued so far)", mbox->comm_queue.size());
-      other_comm = this_synchro;
-      mbox->push(this_synchro);
+      other_comm = std::move(this_synchro);
+      mbox->push(other_comm);
     } else {
       XBT_DEBUG("Match my %p with the existing %p", this_synchro.get(), other_comm.get());
 
@@ -471,8 +471,8 @@ static inline void SIMIX_comm_start(simgrid::kernel::activity::CommImplPtr comm)
 
     /* If any of the process is suspend, create the synchro but stop its execution,
        it will be restarted when the sender process resume */
-    if (SIMIX_process_is_suspended(comm->src_proc) || SIMIX_process_is_suspended(comm->dst_proc)) {
-      if (SIMIX_process_is_suspended(comm->src_proc))
+    if (comm->src_proc->isSuspended() || comm->dst_proc->isSuspended()) {
+      if (comm->src_proc->isSuspended())
         XBT_DEBUG("The communication is suspended on startup because src (%s@%s) was suspended since it initiated the "
                   "communication",
                   comm->src_proc->cname(), comm->src_proc->host->cname());