void wait_until(double time_limit);
/** Cancel that activity */
- virtual Activity* cancel() = 0;
+ Activity* cancel();
/** Retrieve the current state of the activity */
Activity::State get_state() const { return state_; }
/** Return a string representation of the activity's state (one of INITED, STARTING, STARTED, CANCELED, FINISHED) */
Activity::vetoable_start();
return static_cast<AnyActivity*>(this);
}
+
+ AnyActivity* cancel() { return static_cast<AnyActivity*>(Activity::cancel()); }
#ifndef DOXYGEN
/* The refcounting is done in the ancestor class, Activity, but we want each of the classes benefiting of the CRTP
* (Exec, Comm, etc) to have smart pointers too, so we define these methods here, that forward the ptr_release and
Comm* start() override;
Comm* wait() override;
Comm* wait_for(double timeout) override;
- Comm* cancel() override;
bool test() override;
/** Start the comm, and ignore its result. It can be completely forgotten after that. */
static int wait_any(std::vector<ExecPtr>* execs) { return wait_any_for(execs, -1); }
/*! Same as wait_any, but with a timeout. If the timeout occurs, parameter last is returned.*/
static int wait_any_for(std::vector<ExecPtr>* execs, double timeout);
- Exec* cancel() override;
/** @brief On sequential executions, returns the amount of flops that remain to be done; This cannot be used on
* parallel executions. */
Io* start() override;
Io* wait() override;
Io* wait_for(double timeout) override;
- Io* cancel() override;
double get_remaining() const override;
sg_size_t get_performed_ioops() const;
return false;
}
+Activity* Activity::cancel()
+{
+ kernel::actor::simcall([this] { pimpl_->cancel(); });
+ complete(State::CANCELED);
+ return this;
+}
+
Activity* Activity::suspend()
{
if (suspended_)
return this;
}
-Comm* Comm::cancel()
-{
- kernel::actor::simcall([this] {
- if (pimpl_)
- boost::static_pointer_cast<kernel::activity::CommImpl>(pimpl_)->cancel();
- });
- complete(State::CANCELED);
- return this;
-}
-
bool Comm::test() // TODO: merge with Activity::test, once modernized
{
xbt_assert(state_ == State::INITED || state_ == State::STARTED || state_ == State::STARTING ||
return changed_pos;
}
-Exec* Exec::cancel()
-{
- kernel::actor::simcall([this] { boost::static_pointer_cast<kernel::activity::ExecImpl>(pimpl_)->cancel(); });
- complete(State::CANCELED);
- return this;
-}
-
/** @brief change the execution bound
* This means changing the maximal amount of flops per second that it may consume, regardless of what the host may
* deliver. Currently, this cannot be changed once the exec started.
return this;
}
-Io* Io::cancel()
-{
- kernel::actor::simcall([this] { boost::static_pointer_cast<kernel::activity::IoImpl>(pimpl_)->cancel(); });
- complete(State::CANCELED);
- return this;
-}
-
Io* Io::wait()
{
return this->wait_for(-1);