Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move hosts_ to private, and deal with consequences
[simgrid.git] / src / kernel / activity / CommImpl.cpp
index 143ebf8..e027255 100644 (file)
@@ -64,7 +64,7 @@ CommImpl& CommImpl::set_source(s4u::Host* from)
 {
   xbt_assert( from_ == nullptr );
   from_ = from;
-  hosts_.push_back(from);
+  add_host(from);
   return *this;
 }
 
@@ -72,7 +72,7 @@ CommImpl& CommImpl::set_destination(s4u::Host* to)
 {
   xbt_assert( to_ == nullptr );
   to_ = to;
-  hosts_.push_back(to_);
+  add_host(to_);
   return *this;
 }
 
@@ -112,6 +112,7 @@ CommImpl& CommImpl::set_dst_buff(unsigned char* buff, size_t* size)
 CommImpl& CommImpl::detach()
 {
   detached_ = true;
+  EngineImpl::get_instance()->get_maestro()->activities_.emplace_back(this);
   return *this;
 }
 
@@ -266,7 +267,6 @@ ActivityImplPtr CommImpl::isend(actor::CommIsendSimcall* observer)
   if (observer->is_detached()) {
     other_comm->detach();
     other_comm->clean_fun = observer->get_clean_fun();
-    EngineImpl::get_instance()->get_maestro()->activities_.emplace_back(other_comm);
   } else {
     other_comm->clean_fun = nullptr;
     observer->get_issuer()->activities_.emplace_back(other_comm);