Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use only the C++ dtor for Synchro::Raw
[simgrid.git] / src / simix / smx_network.cpp
index bec9527..3db60d6 100644 (file)
@@ -215,11 +215,9 @@ smx_synchro_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_process_t sr
   }
   xbt_fifo_push(src_proc->comms, other_synchro);
 
-  /* if the communication synchro is detached then decrease the refcount
-   * by one, so it will be eliminated by the receiver's destroy call */
+
   if (detached) {
     other_comm->detached = true;
-    other_comm->ref();
     other_comm->clean_fun = clean_fun;
   } else {
     other_comm->clean_fun = NULL;
@@ -683,6 +681,8 @@ void SIMIX_comm_finish(smx_synchro_t synchro)
       if(simcall->issuer == comm->dst_proc){
         if(comm->src_proc)
           xbt_fifo_remove(comm->src_proc->comms, synchro);
+        //in case of a detached comm we have an extra ref to remove, as the sender won't do it
+        destroy_count++;
       }
     }
     SIMIX_simcall_answer(simcall);
@@ -693,44 +693,6 @@ void SIMIX_comm_finish(smx_synchro_t synchro)
     static_cast<simgrid::simix::Comm*>(synchro)->unref();
 }
 
-/**
- * \brief This function is called when a Surf communication synchro is finished.
- * \param synchro the corresponding Simix communication
- */
-void SIMIX_post_comm(smx_synchro_t synchro)
-{
-  simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
-
-  /* Update synchro state */
-  if (comm->src_timeout &&
-      comm->src_timeout->getState() == simgrid::surf::Action::State::done)
-    synchro->state = SIMIX_SRC_TIMEOUT;
-  else if (comm->dst_timeout &&
-    comm->dst_timeout->getState() == simgrid::surf::Action::State::done)
-    synchro->state = SIMIX_DST_TIMEOUT;
-  else if (comm->src_timeout &&
-    comm->src_timeout->getState() == simgrid::surf::Action::State::failed)
-    synchro->state = SIMIX_SRC_HOST_FAILURE;
-  else if (comm->dst_timeout &&
-      comm->dst_timeout->getState() == simgrid::surf::Action::State::failed)
-    synchro->state = SIMIX_DST_HOST_FAILURE;
-  else if (comm->surf_comm &&
-    comm->surf_comm->getState() == simgrid::surf::Action::State::failed) {
-    synchro->state = SIMIX_LINK_FAILURE;
-  } else
-    synchro->state = SIMIX_DONE;
-
-  XBT_DEBUG("SIMIX_post_comm: comm %p, state %d, src_proc %p, dst_proc %p, detached: %d",
-            comm, (int)comm->state, comm->src_proc, comm->dst_proc, comm->detached);
-
-  /* destroy the surf actions associated with the Simix communication */
-  comm->cleanupSurf();
-
-  /* if there are simcalls associated with the synchro, then answer them */
-  if (xbt_fifo_size(synchro->simcalls))
-    SIMIX_comm_finish(comm);
-}
-
 /******************************************************************************/
 /*                    SIMIX_comm_copy_data callbacks                       */
 /******************************************************************************/