+ if (not simcalls_.empty())
+ finish();
+}
+
+void ExecImpl::finish()
+{
+ while (not simcalls_.empty()) {
+ smx_simcall_t simcall = simcalls_.front();
+ simcalls_.pop_front();
+ switch (state_) {
+
+ case SIMIX_DONE:
+ /* do nothing, synchro done */
+ XBT_DEBUG("ExecImpl::finish(): execution successful");
+ break;
+
+ case SIMIX_FAILED:
+ XBT_DEBUG("ExecImpl::finish(): host '%s' failed", simcall->issuer->get_host()->get_cname());
+ simcall->issuer->context_->iwannadie = true;
+ simcall->issuer->exception_ =
+ std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed"));
+ break;
+
+ case SIMIX_CANCELED:
+ XBT_DEBUG("ExecImpl::finish(): execution canceled");
+ simcall->issuer->exception_ =
+ std::make_exception_ptr(simgrid::CancelException(XBT_THROW_POINT, "Execution Canceled"));
+ break;
+
+ case SIMIX_TIMEOUT:
+ XBT_DEBUG("ExecImpl::finish(): execution timeouted");
+ simcall->issuer->exception_ = std::make_exception_ptr(simgrid::TimeoutError(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;
+ simcall_execution_wait__set__result(simcall, state_);
+
+ /* Fail the process if the host is down */
+ if (simcall->issuer->get_host()->is_on())
+ SIMIX_simcall_answer(simcall);
+ else
+ simcall->issuer->context_->iwannadie = true;
+ }