Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://framagit.org/simgrid/simgrid
[simgrid.git] / src / kernel / activity / CommImpl.cpp
index 5f19980..9817117 100644 (file)
@@ -189,8 +189,7 @@ void simcall_HANDLER_comm_wait(smx_simcall_t simcall, simgrid::kernel::activity:
   /* Associate this simcall to the wait synchro */
   XBT_DEBUG("simcall_HANDLER_comm_wait, %p", comm);
 
-  comm->simcalls_.push_back(simcall);
-  simcall->issuer->waiting_synchro = comm;
+  comm->register_simcall(simcall);
 
   if (MC_is_active() || MC_record_replay_is_active()) {
     int idx = SIMCALL_GET_MC_VALUE(simcall);
@@ -218,7 +217,7 @@ void simcall_HANDLER_comm_wait(smx_simcall_t simcall, simgrid::kernel::activity:
     comm->finish();
   } else { /* we need a sleep action (even when there is no timeout) to be notified of host failures */
     simgrid::kernel::resource::Action* sleep = simcall->issuer->get_host()->pimpl_cpu->sleep(timeout);
-    sleep->set_data(comm);
+    sleep->set_activity(comm);
 
     if (simcall->issuer == comm->src_actor_)
       comm->src_timeout_ = sleep;
@@ -229,7 +228,7 @@ void simcall_HANDLER_comm_wait(smx_simcall_t simcall, simgrid::kernel::activity:
 
 void simcall_HANDLER_comm_test(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comm)
 {
-  int res;
+  bool res;
 
   if (MC_is_active() || MC_record_replay_is_active()) {
     res = comm->src_actor_ && comm->dst_actor_;
@@ -422,7 +421,7 @@ CommImpl* CommImpl::start()
     s4u::Host* receiver = dst_actor_->get_host();
 
     surf_action_ = surf_network_model->communicate(sender, receiver, size_, rate_);
-    surf_action_->set_data(this);
+    surf_action_->set_activity(this);
     surf_action_->set_category(get_tracing_category());
     state_ = SIMIX_RUNNING;
 
@@ -520,10 +519,7 @@ void CommImpl::cancel()
 /** @brief This is part of the cleanup process, probably an internal command */
 void CommImpl::cleanupSurf()
 {
-  if (surf_action_) {
-    surf_action_->unref();
-    surf_action_ = nullptr;
-  }
+  clean_action();
 
   if (src_timeout_) {
     src_timeout_->unref();