Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
transparent cleanups around simcalls mechanism
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 12 Aug 2019 10:04:18 +0000 (12:04 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Thu, 15 Aug 2019 13:37:40 +0000 (15:37 +0200)
src/kernel/activity/CommImpl.cpp
src/kernel/activity/ExecImpl.cpp
src/simix/popping_private.hpp

index 3a3982d..28c30e9 100644 (file)
@@ -307,9 +307,9 @@ void simcall_HANDLER_comm_waitany(smx_simcall_t simcall, simgrid::kernel::activi
   }
 
   if (timeout < 0.0) {
-    simcall->timer = NULL;
+    simcall->timeout_cb = NULL;
   } else {
-    simcall->timer = simgrid::simix::Timer::set(SIMIX_get_clock() + timeout, [simcall]() {
+    simcall->timeout_cb = simgrid::simix::Timer::set(SIMIX_get_clock() + timeout, [simcall]() {
       SIMIX_waitany_remove_simcall_from_actions(simcall);
       simcall_comm_waitany__set__result(simcall, -1);
       simcall->issuer->simcall_answer();
@@ -584,9 +584,9 @@ void CommImpl::finish()
       continue;                        // if process handling comm is killed
     if (simcall->call == SIMCALL_COMM_WAITANY) {
       SIMIX_waitany_remove_simcall_from_actions(simcall);
-      if (simcall->timer) {
-        simcall->timer->remove();
-        simcall->timer = nullptr;
+      if (simcall->timeout_cb) {
+        simcall->timeout_cb->remove();
+        simcall->timeout_cb = nullptr;
       }
       if (not MC_is_active() && not MC_record_replay_is_active()) {
         CommImpl** comms   = simcall_comm_waitany__get__comms(simcall);
index 2558315..cfdf73e 100644 (file)
@@ -52,9 +52,9 @@ void simcall_HANDLER_execution_waitany_for(smx_simcall_t simcall, simgrid::kerne
                                            size_t count, double timeout)
 {
   if (timeout < 0.0) {
-    simcall->timer = nullptr;
+    simcall->timeout_cb = nullptr;
   } else {
-    simcall->timer = simgrid::simix::Timer::set(SIMIX_get_clock() + timeout, [simcall, execs, count]() {
+    simcall->timeout_cb = simgrid::simix::Timer::set(SIMIX_get_clock() + timeout, [simcall, execs, count]() {
       for (size_t i = 0; i < count; i++) {
         // Remove the first occurence of simcall:
         auto* exec = execs[i];
@@ -232,9 +232,9 @@ void ExecImpl::finish()
         if (j != exec->simcalls_.end())
           exec->simcalls_.erase(j);
 
-        if (simcall->timer) {
-          simcall->timer->remove();
-          simcall->timer = nullptr;
+        if (simcall->timeout_cb) {
+          simcall->timeout_cb->remove();
+          simcall->timeout_cb = nullptr;
         }
       }
 
index 476c871..83f7e2d 100644 (file)
@@ -45,7 +45,7 @@ union u_smx_scalar {
 struct s_smx_simcall {
   e_smx_simcall_t call;
   smx_actor_t issuer;
-  smx_timer_t timer;
+  smx_timer_t timeout_cb; // Callback to timeouts
   int mc_value;
   u_smx_scalar args[11];
   u_smx_scalar result;
@@ -176,20 +176,20 @@ template <class T> inline typename std::remove_reference<T>::type unmarshal_raw(
   return unmarshal(type<T>(), simcall);
 }
 
-template <std::size_t I> inline void marshalArgs(smx_simcall_t simcall)
+template <std::size_t I> inline void marshal_args(smx_simcall_t simcall)
 {
   /* Nothing to do when no args */
 }
 
-template <std::size_t I, class A> inline void marshalArgs(smx_simcall_t simcall, A const& a)
+template <std::size_t I, class A> inline void marshal_args(smx_simcall_t simcall, A const& a)
 {
   marshal(simcall->args[I], a);
 }
 
-template <std::size_t I, class A, class... B> inline void marshalArgs(smx_simcall_t simcall, A const& a, B const&... b)
+template <std::size_t I, class A, class... B> inline void marshal_args(smx_simcall_t simcall, A const& a, B const&... b)
 {
   marshal(simcall->args[I], a);
-  marshalArgs<I + 1>(simcall, b...);
+  marshal_args<I + 1>(simcall, b...);
 }
 
 /** Initialize the simcall */
@@ -198,7 +198,7 @@ template <class... A> inline void marshal(smx_simcall_t simcall, e_smx_simcall_t
   simcall->call = call;
   memset(&simcall->result, 0, sizeof(simcall->result));
   memset(simcall->args, 0, sizeof(simcall->args));
-  marshalArgs<0>(simcall, a...);
+  marshal_args<0>(simcall, a...);
 }
 }
 }