Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge with framagit/master
[simgrid.git] / src / s4u / s4u_Io.cpp
index cc9794a..736336a 100644 (file)
@@ -12,6 +12,8 @@
 
 namespace simgrid {
 namespace s4u {
+xbt::signal<void(Io const&)> Io::on_start;
+xbt::signal<void(Io const&)> Io::on_completion;
 
 Io::Io(sg_disk_t disk, sg_size_t size, OpType type) : disk_(disk), size_(size), type_(type)
 {
@@ -44,7 +46,12 @@ Io* Io::start()
           .start();
     }
   });
+
+  if (suspended_)
+    pimpl_->suspend();
+
   state_ = State::STARTED;
+  on_start(*this);
   return this;
 }
 
@@ -69,6 +76,8 @@ Io* Io::wait_for(double timeout)
   kernel::actor::simcall_blocking<void>([this, issuer, timeout] { this->get_impl()->wait_for(issuer, timeout); });
   state_ = State::FINISHED;
   this->release_dependencies();
+
+  on_completion(*this);
   return this;
 }