Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
port a blocking simcall to the modernity
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 9 Aug 2019 23:12:06 +0000 (01:12 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 9 Aug 2019 23:12:06 +0000 (01:12 +0200)
include/simgrid/simix.h
src/kernel/actor/ActorImpl.cpp
src/s4u/s4u_Actor.cpp
src/simix/libsmx.cpp
src/simix/popping_accessors.hpp
src/simix/popping_bodies.cpp
src/simix/popping_enum.h
src/simix/popping_generated.cpp
src/simix/simcalls.in

index 303093b..bd2601c 100644 (file)
@@ -180,7 +180,9 @@ SG_BEGIN_DECL()
 void simcall_process_set_data(smx_actor_t process, void* data);
 /* Process handling */
 XBT_PUBLIC void simcall_process_suspend(smx_actor_t process);
 void simcall_process_set_data(smx_actor_t process, void* data);
 /* Process handling */
 XBT_PUBLIC void simcall_process_suspend(smx_actor_t process);
-XBT_PUBLIC void simcall_process_join(smx_actor_t process, double timeout);
+
+XBT_ATTRIB_DEPRECATED_v327("Please use Actor::join()") XBT_PUBLIC
+    void simcall_process_join(smx_actor_t process, double timeout);
 
 /* Sleep control */
 XBT_PUBLIC e_smx_state_t simcall_process_sleep(double duration);
 
 /* Sleep control */
 XBT_PUBLIC e_smx_state_t simcall_process_sleep(double duration);
index 1919779..08199ba 100644 (file)
@@ -600,19 +600,6 @@ const char* SIMIX_process_self_get_name()
   return process->get_cname();
 }
 
   return process->get_cname();
 }
 
-void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_actor_t actor, double timeout)
-{
-  if (actor->finished_) {
-    // The joined process is already finished, just wake up the issuer process right away
-    simcall_process_sleep__set__result(simcall, SIMIX_DONE);
-    simcall->issuer->simcall_answer();
-    return;
-  }
-  smx_activity_t sync = simcall->issuer->join(actor, timeout);
-  sync->simcalls_.push_back(simcall);
-  simcall->issuer->waiting_synchro = sync;
-}
-
 void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double duration)
 {
   if (MC_is_active() || MC_record_replay_is_active()) {
 void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double duration)
 {
   if (MC_is_active() || MC_record_replay_is_active()) {
index 33d319a..5732d13 100644 (file)
@@ -86,12 +86,23 @@ int Actor::get_refcount()
 
 void Actor::join()
 {
 
 void Actor::join()
 {
-  simcall_process_join(this->pimpl_, -1);
+  join(-1);
 }
 
 void Actor::join(double timeout)
 {
 }
 
 void Actor::join(double timeout)
 {
-  simcall_process_join(this->pimpl_, timeout);
+  auto issuer = SIMIX_process_self();
+  auto target = pimpl_;
+  simix::simcall_blocking([issuer, target, timeout] {
+    if (target->finished_) {
+      // The joined process is already finished, just wake up the issuer right away
+      issuer->simcall_answer();
+    } else {
+      smx_activity_t sync = issuer->join(target, timeout);
+      sync->simcalls_.push_back(&issuer->simcall);
+      issuer->waiting_synchro = sync;
+    }
+  });
 }
 
 void Actor::set_auto_restart(bool autorestart)
 }
 
 void Actor::set_auto_restart(bool autorestart)
index 402c6a7..010360d 100644 (file)
@@ -46,7 +46,7 @@ unsigned int simcall_execution_waitany_for(simgrid::kernel::activity::ExecImpl*
 
 void simcall_process_join(smx_actor_t process, double timeout)
 {
 
 void simcall_process_join(smx_actor_t process, double timeout)
 {
-  simcall_BODY_process_join(process, timeout);
+  SIMIX_process_self()->join(process, timeout);
 }
 
 /**
 }
 
 /**
index d175c0d..5fe37d3 100644 (file)
@@ -28,43 +28,6 @@ static inline void simcall_process_suspend__set__process(smx_simcall_t simcall,
   simgrid::simix::marshal<smx_actor_t>(simcall->args[0], arg);
 }
 
   simgrid::simix::marshal<smx_actor_t>(simcall->args[0], arg);
 }
 
-static inline smx_actor_t simcall_process_join__get__process(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]);
-}
-static inline smx_actor_t simcall_process_join__getraw__process(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<smx_actor_t>(simcall->args[0]);
-}
-static inline void simcall_process_join__set__process(smx_simcall_t simcall, smx_actor_t arg)
-{
-  simgrid::simix::marshal<smx_actor_t>(simcall->args[0], arg);
-}
-static inline double simcall_process_join__get__timeout(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<double>(simcall->args[1]);
-}
-static inline double simcall_process_join__getraw__timeout(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<double>(simcall->args[1]);
-}
-static inline void simcall_process_join__set__timeout(smx_simcall_t simcall, double arg)
-{
-  simgrid::simix::marshal<double>(simcall->args[1], arg);
-}
-static inline int simcall_process_join__get__result(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<int>(simcall->result);
-}
-static inline int simcall_process_join__getraw__result(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<int>(simcall->result);
-}
-static inline void simcall_process_join__set__result(smx_simcall_t simcall, int result)
-{
-  simgrid::simix::marshal<int>(simcall->result, result);
-}
-
 static inline double simcall_process_sleep__get__duration(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal<double>(simcall->args[0]);
 static inline double simcall_process_sleep__get__duration(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal<double>(simcall->args[0]);
@@ -1075,7 +1038,6 @@ static inline void simcall_run_blocking__set__code(smx_simcall_t simcall, std::f
 /* The prototype of all simcall handlers, automatically generated for you */
 
 XBT_PRIVATE void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_actor_t process);
 /* The prototype of all simcall handlers, automatically generated for you */
 
 XBT_PRIVATE void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_actor_t process);
-XBT_PRIVATE void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_actor_t process, double timeout);
 XBT_PRIVATE void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double duration);
 XBT_PRIVATE void simcall_HANDLER_execution_wait(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl* execution);
 XBT_PRIVATE void simcall_HANDLER_execution_waitany_for(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl** execs, size_t count, double timeout);
 XBT_PRIVATE void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double duration);
 XBT_PRIVATE void simcall_HANDLER_execution_wait(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl* execution);
 XBT_PRIVATE void simcall_HANDLER_execution_waitany_for(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl** execs, size_t count, double timeout);
index 3539455..8239a76 100644 (file)
@@ -46,13 +46,6 @@ inline static void simcall_BODY_process_suspend(smx_actor_t process)
   return simcall<void, smx_actor_t>(SIMCALL_PROCESS_SUSPEND, process);
 }
 
   return simcall<void, smx_actor_t>(SIMCALL_PROCESS_SUSPEND, process);
 }
 
-inline static int simcall_BODY_process_join(smx_actor_t process, double timeout)
-{
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
-    simcall_HANDLER_process_join(&SIMIX_process_self()->simcall, process, timeout);
-  return simcall<int, smx_actor_t, double>(SIMCALL_PROCESS_JOIN, process, timeout);
-}
-
 inline static int simcall_BODY_process_sleep(double duration)
 {
   if (0) /* Go to that function to follow the code flow through the simcall barrier */
 inline static int simcall_BODY_process_sleep(double duration)
 {
   if (0) /* Go to that function to follow the code flow through the simcall barrier */
index 45a78da..0d9f34f 100644 (file)
@@ -20,7 +20,6 @@
 typedef enum {
   SIMCALL_NONE,
   SIMCALL_PROCESS_SUSPEND,
 typedef enum {
   SIMCALL_NONE,
   SIMCALL_PROCESS_SUSPEND,
-  SIMCALL_PROCESS_JOIN,
   SIMCALL_PROCESS_SLEEP,
   SIMCALL_EXECUTION_WAIT,
   SIMCALL_EXECUTION_WAITANY_FOR,
   SIMCALL_PROCESS_SLEEP,
   SIMCALL_EXECUTION_WAIT,
   SIMCALL_EXECUTION_WAITANY_FOR,
index a4cc938..981f3b9 100644 (file)
@@ -27,7 +27,6 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);
 const char* simcall_names[] = {
     "SIMCALL_NONE",
     "SIMCALL_PROCESS_SUSPEND",
 const char* simcall_names[] = {
     "SIMCALL_NONE",
     "SIMCALL_PROCESS_SUSPEND",
-    "SIMCALL_PROCESS_JOIN",
     "SIMCALL_PROCESS_SLEEP",
     "SIMCALL_EXECUTION_WAIT",
     "SIMCALL_EXECUTION_WAITANY_FOR",
     "SIMCALL_PROCESS_SLEEP",
     "SIMCALL_EXECUTION_WAIT",
     "SIMCALL_EXECUTION_WAITANY_FOR",
@@ -68,10 +67,6 @@ void simgrid::kernel::actor::ActorImpl::simcall_handle(int value) {
       simcall_HANDLER_process_suspend(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]));
       break;
 
       simcall_HANDLER_process_suspend(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]));
       break;
 
-    case SIMCALL_PROCESS_JOIN:
-      simcall_HANDLER_process_join(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]), simgrid::simix::unmarshal<double>(simcall.args[1]));
-      break;
-
     case SIMCALL_PROCESS_SLEEP:
       simcall_HANDLER_process_sleep(&simcall, simgrid::simix::unmarshal<double>(simcall.args[0]));
       break;
     case SIMCALL_PROCESS_SLEEP:
       simcall_HANDLER_process_sleep(&simcall, simgrid::simix::unmarshal<double>(simcall.args[0]));
       break;
index 8dd096b..5bbbaec 100644 (file)
@@ -36,7 +36,6 @@
 # ./include/simgrid/simix.h (otherwise you will get a warning at compile time)
 
 void process_suspend(smx_actor_t process) [[block]];
 # ./include/simgrid/simix.h (otherwise you will get a warning at compile time)
 
 void process_suspend(smx_actor_t process) [[block]];
-int  process_join(smx_actor_t process, double timeout) [[block]];
 int  process_sleep(double duration) [[block]];
 
 int           execution_wait(simgrid::kernel::activity::ExecImpl* execution) [[block]];
 int  process_sleep(double duration) [[block]];
 
 int           execution_wait(simgrid::kernel::activity::ExecImpl* execution) [[block]];