- simgrid::kernel::actor::simcall([this] { boost::static_pointer_cast<kernel::activity::IoImpl>(pimpl_)->cancel(); });
- state_ = State::CANCELED;
+ xbt_assert(state_ == State::INITED || state_ == State::STARTING, "Cannot set disk once the Io is started");
+
+ kernel::actor::simcall(
+ [this, disk] { boost::static_pointer_cast<kernel::activity::IoImpl>(pimpl_)->set_disk(disk->get_impl()); });
+
+ // Setting the disk may allow to start the activity, let's try
+ if (state_ == State::STARTING)
+ vetoable_start();
+
+ return this;
+}
+
+IoPtr Io::set_priority(double priority)
+{
+ xbt_assert(state_ == State::INITED || state_ == State::STARTING,
+ "Cannot change the priority of an io after its start");
+ kernel::actor::simcall([this, priority] {
+ boost::static_pointer_cast<kernel::activity::IoImpl>(pimpl_)->set_sharing_penalty(1. / priority);
+ });