Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename ActorImpl::comms into activities.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 11 Mar 2020 23:01:01 +0000 (00:01 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 12 Mar 2020 14:34:42 +0000 (15:34 +0100)
src/kernel/activity/CommImpl.cpp
src/kernel/actor/ActorImpl.cpp
src/kernel/actor/ActorImpl.hpp

index 0ed0972..d13a1d1 100644 (file)
@@ -78,7 +78,7 @@ XBT_PRIVATE simgrid::kernel::activity::ActivityImplPtr simcall_HANDLER_comm_isen
     other_comm->clean_fun = clean_fun;
   } else {
     other_comm->clean_fun = nullptr;
-    src_proc->comms.push_back(other_comm);
+    src_proc->activities.push_back(other_comm);
   }
 
   /* Setup the communication synchro */
@@ -162,7 +162,7 @@ simcall_HANDLER_comm_irecv(smx_simcall_t /*simcall*/, smx_actor_t receiver, smx_
       other_comm->state_ = simgrid::kernel::activity::State::READY;
       other_comm->set_type(simgrid::kernel::activity::CommImpl::Type::READY);
     }
-    receiver->comms.push_back(other_comm);
+    receiver->activities.push_back(other_comm);
   }
 
   /* Setup communication synchro */
@@ -700,17 +700,17 @@ void CommImpl::finish()
     }
 
     simcall->issuer_->waiting_synchro = nullptr;
-    simcall->issuer_->comms.remove(this);
+    simcall->issuer_->activities.remove(this);
     if (detached_) {
       if (simcall->issuer_ == src_actor_) {
         if (dst_actor_)
-          dst_actor_->comms.remove(this);
+          dst_actor_->activities.remove(this);
       } else if (simcall->issuer_ == dst_actor_) {
         if (src_actor_)
-          src_actor_->comms.remove(this);
+          src_actor_->activities.remove(this);
       } else {
-        dst_actor_->comms.remove(this);
-        src_actor_->comms.remove(this);
+        dst_actor_->activities.remove(this);
+        src_actor_->activities.remove(this);
       }
     }
   }
index a6bc8e9..387f597 100644 (file)
@@ -166,9 +166,9 @@ void ActorImpl::cleanup()
   undaemonize();
 
   /* cancel non-blocking activities */
-  for (auto activity : comms)
-    boost::static_pointer_cast<activity::CommImpl>(activity)->cancel();
-  comms.clear();
+  for (auto activity : activities)
+    activity->cancel();
+  activities.clear();
 
   XBT_DEBUG("%s@%s(%ld) should not run anymore", get_cname(), get_host()->get_cname(), get_pid());
 
@@ -211,7 +211,6 @@ void ActorImpl::exit()
     if (exec != nullptr) {
       exec->clean_action();
     } else if (comm != nullptr) {
-      comms.remove(waiting_synchro);
       // Remove first occurrence of &actor->simcall:
       auto i = boost::range::find(waiting_synchro->simcalls_, &simcall);
       if (i != waiting_synchro->simcalls_.end())
@@ -220,6 +219,7 @@ void ActorImpl::exit()
       activity::ActivityImplPtr(waiting_synchro)->finish();
     }
 
+    activities.remove(waiting_synchro);
     waiting_synchro = nullptr;
   }
 
@@ -427,12 +427,7 @@ void ActorImpl::throw_exception(std::exception_ptr e)
   /* cancel the blocking synchro if any */
   if (waiting_synchro) {
     waiting_synchro->cancel();
-
-    activity::CommImplPtr comm = boost::dynamic_pointer_cast<activity::CommImpl>(waiting_synchro);
-
-    if (comm != nullptr)
-      comms.remove(comm);
-
+    activities.remove(waiting_synchro);
     waiting_synchro = nullptr;
   }
 }
index 1efe8da..9349f8f 100644 (file)
@@ -69,7 +69,7 @@ public:
   bool suspended_ = false;
 
   activity::ActivityImplPtr waiting_synchro = nullptr; /* the current blocking synchro if any */
-  std::list<activity::ActivityImplPtr> comms;          /* the current non-blocking communication synchros */
+  std::list<activity::ActivityImplPtr> activities;     /* the current non-blocking synchros */
   s_smx_simcall simcall;
   /* list of functions executed when the process dies */
   std::shared_ptr<std::vector<std::function<void(bool)>>> on_exit =