-void ExecImpl::post()
-{
- xbt_assert(surf_action_ != nullptr);
- if (std::any_of(hosts_.begin(), hosts_.end(), [](const s4u::Host* host) { return not host->is_on(); })) {
- /* If one of the hosts running the synchro failed, notice it. This way, the asking
- * process can be killed if it runs on that host itself */
- set_state(State::FAILED);
- } else if (surf_action_->get_state() == resource::Action::State::FAILED) {
- /* If all the hosts are running the synchro didn't fail, then the synchro was canceled */
- set_state(State::CANCELED);
- } else if (timeout_detector_ && timeout_detector_->get_state() == resource::Action::State::FINISHED) {
- if (surf_action_->get_remains() > 0.0) {
- surf_action_->set_state(resource::Action::State::FAILED);
- set_state(State::TIMEOUT);
- } else {
- set_state(State::DONE);
- }
- } else {
- set_state(State::DONE);
- }
-
- clean_action();
- timeout_detector_.reset();
- if (get_actor() != nullptr) {
- get_actor()->activities_.remove(this);
- }
- if (get_state() != State::FAILED && cb_id_ >= 0)
- s4u::Host::on_state_change.disconnect(cb_id_);
- /* Answer all simcalls associated with the synchro */
- finish();
-}
-