Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
associate a s4u::Comm to a kernel::activity::CommImpl (partial set for now because...
authorSUTER Frederic <frederic.suter@cc.in2p3.fr>
Wed, 22 Dec 2021 08:11:49 +0000 (09:11 +0100)
committerSUTER Frederic <frederic.suter@cc.in2p3.fr>
Wed, 22 Dec 2021 10:20:34 +0000 (11:20 +0100)
src/kernel/activity/CommImpl.hpp
src/s4u/s4u_Comm.cpp

index a71052f..b190e8e 100644 (file)
@@ -26,6 +26,7 @@ class XBT_PUBLIC CommImpl : public ActivityImpl_T<CommImpl> {
   MailboxImpl* mbox_ = nullptr; /* Rendez-vous where the comm is queued */
   s4u::Host* from_   = nullptr; /* Pre-determined only for direct host-to-host communications */
   s4u::Host* to_     = nullptr; /* Otherwise, computed at start() time from the actors */
+  s4u::Comm* piface_ = nullptr;
 
 public:
   enum class Type { SEND, RECEIVE };
@@ -35,6 +36,8 @@ public:
   explicit CommImpl(Type type) : type_(type) {}
   CommImpl(s4u::Host* from, s4u::Host* to, double bytes);
 
+  void set_iface(s4u::Comm* piface) { piface_ = piface; }
+  s4u::Comm* get_iface() const { return piface_; }
   CommImpl& set_size(double size);
   CommImpl& set_src_buff(unsigned char* buff, size_t size);
   CommImpl& set_dst_buff(unsigned char* buff, size_t* size);
index 8db5454..c58896f 100644 (file)
@@ -212,6 +212,8 @@ Comm* Comm::start()
   if (suspended_)
     pimpl_->suspend();
 
+  if (not detached_)
+    static_cast<kernel::activity::CommImpl*>(pimpl_.get())->set_iface(this);
   state_ = State::STARTED;
   return this;
 }