#include "src/msg/msg_private.hpp"
#include "xbt/log.h"
+#include "simgrid/Exception.hpp"
#include "simgrid/s4u/Comm.hpp"
#include "simgrid/s4u/Mailbox.hpp"
state_ = State::FINISHED;
return this;
+ case State::CANCELED:
+ throw CancelException(XBT_THROW_POINT, "Communication canceled");
+
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;
}