+ if(action->execution.surf_exec)
+ surf_workstation_model->suspend(action->execution.surf_exec);
+}
+
+void SIMIX_host_execution_resume(smx_action_t action)
+{
+ if(action->execution.surf_exec)
+ surf_workstation_model->suspend(action->execution.surf_exec);
+}
+
+void SIMIX_execution_finish(smx_action_t action)
+{
+ volatile xbt_fifo_item_t item;
+ smx_req_t req;
+
+ xbt_fifo_foreach(action->request_list, item, req, smx_req_t) {
+
+ switch (action->state) {
+
+ case SIMIX_DONE:
+ /* do nothing, action done */
+ XBT_DEBUG("SIMIX_execution_finished: execution successful");
+ break;
+
+ case SIMIX_FAILED:
+ XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", req->issuer->smx_host->name);
+ TRY {
+ THROWF(host_error, 0, "Host failed");
+ }
+ CATCH(req->issuer->running_ctx->exception) {
+ req->issuer->doexception = 1;
+ }
+ break;
+
+ case SIMIX_CANCELED:
+ XBT_DEBUG("SIMIX_execution_finished: execution canceled");
+ TRY {
+ THROWF(cancel_error, 0, "Canceled");
+ }
+ CATCH(req->issuer->running_ctx->exception) {
+ req->issuer->doexception = 1;
+ }
+ break;
+
+ default:
+ xbt_die("Internal error in SIMIX_execution_finish: unexpected action state %d",
+ action->state);
+ }
+ req->issuer->waiting_action = NULL;
+ req->host_execution_wait.result = action->state;
+ SIMIX_request_answer(req);
+ }
+
+ /* We no longer need it */
+ SIMIX_host_execution_destroy(action);
+}