Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
(crudly) deal with I/O launched by maestro
authorSUTER Frederic <frederic.suter@cc.in2p3.fr>
Tue, 21 Dec 2021 16:20:17 +0000 (17:20 +0100)
committerSUTER Frederic <frederic.suter@cc.in2p3.fr>
Tue, 21 Dec 2021 16:20:17 +0000 (17:20 +0100)
include/simgrid/s4u/Io.hpp
src/kernel/EngineImpl.cpp
src/kernel/activity/IoImpl.cpp
src/kernel/activity/IoImpl.hpp

index 2f59686..841f18b 100644 (file)
@@ -22,6 +22,7 @@ namespace s4u {
 class XBT_PUBLIC Io : public Activity_T<Io> {
 #ifndef DOXYGEN
   friend kernel::activity::IoImpl;
+  friend kernel::EngineImpl;
 #endif
 
 protected:
index c674144..15fb9f4 100644 (file)
@@ -422,6 +422,10 @@ void EngineImpl::wake_all_waiting_actors() const
         if (exec != nullptr && exec->get_actor() == maestro_)
           exec->get_iface()->complete(s4u::Activity::State::FAILED);
 
+        auto* io = dynamic_cast<activity::IoImpl*>(action->get_activity());
+        if (io != nullptr && io->get_actor() == maestro_)
+          io->get_iface()->complete(s4u::Activity::State::FAILED);
+
         activity::ActivityImplPtr(action->get_activity())->post();
       }
     }
@@ -439,6 +443,10 @@ void EngineImpl::wake_all_waiting_actors() const
           exec->set_finish_time(action->get_finish_time());
           exec->get_iface()->complete(s4u::Activity::State::FINISHED);
         }
+        auto* io = dynamic_cast<activity::IoImpl*>(action->get_activity());
+        if (io != nullptr && io->get_actor() == maestro_)
+          io->get_iface()->complete(s4u::Activity::State::FINISHED);
+
         activity::ActivityImplPtr(action->get_activity())->post();
       }
     }
index c9f8e35..a6dcf3a 100644 (file)
@@ -26,6 +26,11 @@ namespace activity {
 IoImpl::IoImpl()
 {
   piface_ = new s4u::Io(this);
+  actor::ActorImpl* self = actor::ActorImpl::self();
+  if (self) {
+    actor_ = self;
+    self->activities_.emplace_back(this);
+  }
 }
 
 IoImpl& IoImpl::set_sharing_penalty(double sharing_penalty)
index 0bd71e2..ed3c705 100644 (file)
@@ -14,6 +14,7 @@ namespace kernel {
 namespace activity {
 
 class XBT_PUBLIC IoImpl : public ActivityImpl_T<IoImpl> {
+  actor::ActorImpl* actor_            = nullptr;
   resource::DiskImpl* disk_           = nullptr;
   double sharing_penalty_             = 1.0;
   sg_size_t size_                     = 0;
@@ -21,10 +22,10 @@ class XBT_PUBLIC IoImpl : public ActivityImpl_T<IoImpl> {
   sg_size_t performed_ioops_          = 0;
   resource::Action* timeout_detector_ = nullptr;
   s4u::Io* piface_;
-
 public:
   IoImpl();
   s4u::Io* get_iface() { return piface_; }
+  actor::ActorImpl* get_actor() { return actor_; }
 
   IoImpl& set_sharing_penalty(double sharing_penalty);
   IoImpl& set_timeout(double timeout) override;