+ for (size_t i = 0; i < count; i++) {
+ // Remove the first occurrence of simcall:
+ auto* exec = execs[i];
+ auto j = boost::range::find(exec->simcalls_, simcall);
+ if (j != exec->simcalls_.end())
+ exec->simcalls_.erase(j);
+
+ if (simcall->timeout_cb_) {
+ simcall->timeout_cb_->remove();
+ simcall->timeout_cb_ = nullptr;
+ }
+ }
+
+ if (not MC_is_active() && not MC_record_replay_is_active()) {
+ ExecImpl** element = std::find(execs, execs + count, this);
+ int rank = (element != execs + count) ? element - execs : -1;
+ simcall_execution_waitany_for__set__result(simcall, rank);
+ }
+ }
+
+ switch (state_) {
+
+ case State::DONE:
+ /* do nothing, synchro done */
+ XBT_DEBUG("ExecImpl::finish(): execution successful");
+ break;
+
+ case State::FAILED:
+ XBT_DEBUG("ExecImpl::finish(): host '%s' failed", simcall->issuer_->get_host()->get_cname());
+ simcall->issuer_->context_->iwannadie = true;
+ if (simcall->issuer_->get_host()->is_on())
+ simcall->issuer_->exception_ =
+ std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed"));
+ /* else, the actor will be killed with no possibility to survive */
+ break;
+
+ case State::CANCELED:
+ XBT_DEBUG("ExecImpl::finish(): execution canceled");
+ simcall->issuer_->exception_ =
+ std::make_exception_ptr(simgrid::CancelException(XBT_THROW_POINT, "Execution Canceled"));
+ break;
+
+ case State::TIMEOUT:
+ XBT_DEBUG("ExecImpl::finish(): execution timeouted");
+ simcall->issuer_->exception_ = std::make_exception_ptr(simgrid::TimeoutException(XBT_THROW_POINT, "Timeouted"));
+ break;
+
+ default:
+ xbt_die("Internal error in ExecImpl::finish(): unexpected synchro state %d", static_cast<int>(state_));
+ }
+
+ simcall->issuer_->waiting_synchro = nullptr;
+ /* Fail the process if the host is down */
+ if (simcall->issuer_->get_host()->is_on())
+ simcall->issuer_->simcall_answer();
+ else
+ simcall->issuer_->context_->iwannadie = true;
+ }
+}
+
+ActivityImpl* ExecImpl::migrate(s4u::Host* to)
+{