CommImpl::~CommImpl()
{
- XBT_DEBUG("Really free communication %p", this);
+ XBT_DEBUG("Really free communication %p in state %d (detached = %d)", this, static_cast<int>(state_),
+ static_cast<int>(detached));
cleanupSurf();
if (clean_fun)
clean_fun(src_buff_);
src_buff_ = nullptr;
- }
-
- if (mbox)
+ } else if (mbox) {
mbox->remove(this);
+ }
}
/** @brief Starts the simulation of a communication synchro. */
{
/* if the synchro is a waiting state means that it is still in a mbox so remove from it and delete it */
if (state_ == SIMIX_WAITING) {
- mbox->remove(this);
- state_ = SIMIX_CANCELED;
+ if (not detached) {
+ mbox->remove(this);
+ state_ = SIMIX_CANCELED;
+ }
} else if (not MC_is_active() /* when running the MC there are no surf actions */
&& not MC_record_replay_is_active() && (state_ == SIMIX_READY || state_ == SIMIX_RUNNING)) {
surf_action_->cancel();
if (not simcall->issuer->get_host()->is_on()) {
simcall->issuer->context_->iwannadie = true;
- simcall->issuer->exception_ =
- std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed"));
} else {
switch (state_) {