Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Modernize simcall sem_acquire_timeout.
[simgrid.git] / src / s4u / s4u_Io.cpp
index c88ccc7fd48aff862f87e8ba3bd85cfc45513cd3..926f269024b9e6d92deebae880b1f42339041f55 100644 (file)
@@ -47,6 +47,7 @@ Io* Io::cancel()
 {
   simgrid::kernel::actor::simcall([this] { boost::static_pointer_cast<kernel::activity::IoImpl>(pimpl_)->cancel(); });
   state_ = State::CANCELED;
+  on_completion(*this);
   return this;
 }
 
@@ -72,7 +73,12 @@ Io* Io::wait_for(double timeout)
 IoPtr Io::set_disk(sg_disk_t disk)
 {
   disk_ = disk;
-  return this;
+
+  // Setting the disk may allow to start the activity, let's try
+  if (state_ == State::STARTING)
+    vetoable_start();
+
+ return this;
 }
 
 IoPtr Io::set_size(sg_size_t size)