Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SIMIX_synchro_wait becomes RawImpl::start
[simgrid.git] / src / kernel / activity / CommImpl.cpp
index f55d4d4..e6042d4 100644 (file)
@@ -9,7 +9,6 @@
 #include "simgrid/s4u/Host.hpp"
 #include "src/kernel/activity/MailboxImpl.hpp"
 #include "src/mc/mc_replay.hpp"
-#include "src/simix/smx_network_private.hpp"
 #include "src/surf/network_interface.hpp"
 #include "src/surf/surf_interface.hpp"
 
@@ -38,7 +37,7 @@ namespace simgrid {
 namespace kernel {
 namespace activity {
 
-CommImpl::CommImpl(e_smx_comm_type_t _type) : type(_type)
+CommImpl::CommImpl(CommImpl::Type type) : type(type)
 {
   state_   = SIMIX_WAITING;
   src_data_ = nullptr;
@@ -70,8 +69,8 @@ void CommImpl::start()
   /* If both the sender and the receiver are already there, start the communication */
   if (state_ == SIMIX_READY) {
 
-    s4u::Host* sender   = src_actor_->host_;
-    s4u::Host* receiver = dst_actor_->host_;
+    s4u::Host* sender   = src_actor_->get_host();
+    s4u::Host* receiver = dst_actor_->get_host();
 
     surf_action_ = surf_network_model->communicate(sender, receiver, task_size_, rate_);
     surf_action_->set_data(this);
@@ -86,19 +85,18 @@ void CommImpl::start()
                 receiver->get_cname());
       state_ = SIMIX_LINK_FAILURE;
       cleanupSurf();
-    }
 
-    /* If any of the process is suspended, create the synchro but stop its execution,
-       it will be restarted when the sender process resume */
-    if (src_actor_->is_suspended() || dst_actor_->is_suspended()) {
+    } else if (src_actor_->is_suspended() || dst_actor_->is_suspended()) {
+      /* If any of the process is suspended, create the synchro but stop its execution,
+         it will be restarted when the sender process resume */
       if (src_actor_->is_suspended())
         XBT_DEBUG("The communication is suspended on startup because src (%s@%s) was suspended since it initiated the "
                   "communication",
-                  src_actor_->get_cname(), src_actor_->host_->get_cname());
+                  src_actor_->get_cname(), src_actor_->get_host()->get_cname());
       else
         XBT_DEBUG("The communication is suspended on startup because dst (%s@%s) was suspended since it initiated the "
                   "communication",
-                  dst_actor_->get_cname(), dst_actor_->host_->get_cname());
+                  dst_actor_->get_cname(), dst_actor_->get_host()->get_cname());
 
       surf_action_->suspend();
     }
@@ -114,8 +112,8 @@ void CommImpl::copy_data()
     return;
 
   XBT_DEBUG("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)", this,
-            src_actor_ ? src_actor_->host_->get_cname() : "a finished process", src_buff_,
-            dst_actor_ ? dst_actor_->host_->get_cname() : "a finished process", dst_buff_, buff_size);
+            src_actor_ ? src_actor_->get_host()->get_cname() : "a finished process", src_buff_,
+            dst_actor_ ? dst_actor_->get_host()->get_cname() : "a finished process", dst_buff_, buff_size);
 
   /* Copy at most dst_buff_size bytes of the message to receiver's buffer */
   if (dst_buff_size_)