Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
properly remove the old signals and prevent MC to fire Comm::on_this_completion
authorFred Suter <suterf@ornl.gov>
Thu, 1 Jun 2023 22:06:23 +0000 (18:06 -0400)
committerFred Suter <suterf@ornl.gov>
Thu, 1 Jun 2023 22:06:23 +0000 (18:06 -0400)
src/kernel/activity/CommImpl.cpp
src/kernel/activity/CommImpl.hpp

index dbf9510..3abb315 100644 (file)
@@ -20,8 +20,6 @@
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_network, kernel, "Kernel network-related synchronization");
 
 namespace simgrid::kernel::activity {
-xbt::signal<void(CommImpl const&)> CommImpl::on_start;
-xbt::signal<void(CommImpl const&)> CommImpl::on_completion;
 
 std::function<void(CommImpl*, void*, size_t)> CommImpl::copy_data_callback_ = [](kernel::activity::CommImpl* comm,
                                                                                  void* buff, size_t buff_size) {
@@ -470,9 +468,12 @@ void CommImpl::finish()
   XBT_DEBUG("CommImpl::finish() comm %p, state %s, src_proc %p, dst_proc %p, detached: %d", this, get_state_str(),
             src_actor_.get(), dst_actor_.get(), detached_);
 
-  const s4u::Comm& piface = static_cast<const s4u::Comm&>(*this->get_iface());
-  s4u::Comm::on_completion(piface);
-  //piface.on_this_completion(piface);
+  if (get_iface()) {
+    const auto& piface = static_cast<const s4u::Comm&>(*get_iface());
+    s4u::Comm::on_completion(piface);
+    if (not MC_is_active()) // MC doesn't like when we access user interface from the kernel.
+      piface.on_this_completion(piface);
+  }
 
   /* Update synchro state */
   if (src_timeout_ && src_timeout_->get_state() == resource::Action::State::FINISHED)
index 32fef45..340a19d 100644 (file)
@@ -94,8 +94,6 @@ expectations of the other side, too. See  */
 
   void* src_data_ = nullptr; /* User data associated to the communication */
   void* dst_data_ = nullptr;
-  static xbt::signal<void(CommImpl const&)> on_start;
-  static xbt::signal<void(CommImpl const&)> on_completion;
 };
 } // namespace simgrid::kernel::activity