Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
factor simcall/activity binding
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 5 Apr 2019 14:19:59 +0000 (16:19 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 5 Apr 2019 14:19:59 +0000 (16:19 +0200)
src/kernel/activity/ActivityImpl.cpp
src/kernel/activity/ActivityImpl.hpp
src/kernel/activity/CommImpl.cpp
src/kernel/activity/ExecImpl.cpp
src/kernel/activity/IoImpl.cpp

index 5454050..c5f3524 100644 (file)
@@ -4,6 +4,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/kernel/activity/ActivityImpl.hpp"
+#include "src/simix/smx_private.hpp"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_process);
 
@@ -17,6 +18,12 @@ ActivityImpl::~ActivityImpl()
   XBT_DEBUG("Destroy activity %p", this);
 }
 
+void ActivityImpl::register_simcall(smx_simcall_t simcall)
+{
+  simcalls_.push_back(simcall);
+  simcall->issuer->waiting_synchro = this;
+}
+
 void ActivityImpl::clean_action()
 {
   if (surf_action_) {
index 0d16180..d99f965 100644 (file)
@@ -35,6 +35,7 @@ public:
   virtual void post()   = 0; // What to do when a simcall terminates
   virtual void finish() = 0;
 
+  virtual void register_simcall(smx_simcall_t simcall);
   virtual void clean_action();
   virtual double get_remaining() const;
   // boost::intrusive_ptr<ActivityImpl> support:
index ae219f6..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);
index a2ca6a8..8e1c3e8 100644 (file)
@@ -20,8 +20,7 @@ void simcall_HANDLER_execution_wait(smx_simcall_t simcall, simgrid::kernel::acti
   XBT_DEBUG("Wait for execution of synchro %p, state %d", synchro, (int)synchro->state_);
 
   /* Associate this simcall to the synchro */
-  synchro->simcalls_.push_back(simcall);
-  simcall->issuer->waiting_synchro = synchro;
+  synchro->register_simcall(simcall);
 
   /* set surf's synchro */
   if (MC_is_active() || MC_record_replay_is_active()) {
index 7c23fbb..db99089 100644 (file)
@@ -18,8 +18,7 @@ void simcall_HANDLER_io_wait(smx_simcall_t simcall, simgrid::kernel::activity::I
   XBT_DEBUG("Wait for execution of synchro %p, state %d", synchro, (int)synchro->state_);
 
   /* Associate this simcall to the synchro */
-  synchro->simcalls_.push_back(simcall);
-  simcall->issuer->waiting_synchro = synchro;
+  synchro->register_simcall(simcall);
 
   /* set surf's synchro */
   if (MC_is_active() || MC_record_replay_is_active()) {