* Comm::cancel can be called when there is no pimpl
* if we wait for a canceled activity we can return not let the
impossible happen.
state_ = State::FINISHED;
return this;
+ case State::CANCELED:
+ return this;
default:
THROW_IMPOSSIBLE;
}
Comm* Comm::cancel()
{
- simgrid::simix::simcall([this] { static_cast<kernel::activity::CommImpl*>(pimpl_.get())->cancel(); });
+ simgrid::simix::simcall([this] {
+ if (pimpl_)
+ boost::static_pointer_cast<kernel::activity::CommImpl>(pimpl_)->cancel();
+ });
state_ = State::CANCELED;
return this;
}