+ simdata->isused=1;
+ simdata->compute =
+ SIMIX_req_host_execute(task->name, SIMIX_host_self(),
+ simdata->computation_amount);
+ SIMIX_req_host_execution_set_priority(simdata->compute, simdata->priority);
+#ifdef HAVE_TRACING
+ SIMIX_req_set_category(simdata->compute, task->category);
+#endif
+
+ self->simdata->waiting_action = simdata->compute;
+ SIMIX_req_host_execution_wait(simdata->compute);
+ self->simdata->waiting_action = NULL;
+
+ simdata->isused=0;
+
+ DEBUG2("Execution task '%s' finished in state %d", task->name, SIMIX_req_host_execution_get_state(task->simdata->compute));
+ if (SIMIX_req_host_execution_get_state(task->simdata->compute) == SIMIX_DONE) {
+ /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
+ SIMIX_req_host_execution_destroy(task->simdata->compute);
+ simdata->computation_amount = 0.0;
+ simdata->comm = NULL;
+ simdata->compute = NULL;
+#ifdef HAVE_TRACING
+ TRACE_msg_task_execute_end(task);
+#endif
+ MSG_RETURN(MSG_OK);
+ } else if (SIMIX_req_host_get_state(SIMIX_host_self()) == 0) {
+ /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
+ SIMIX_req_host_execution_destroy(task->simdata->compute);
+ simdata->comm = NULL;
+ simdata->compute = NULL;
+#ifdef HAVE_TRACING
+ TRACE_msg_task_execute_end(task);
+#endif
+ MSG_RETURN(MSG_HOST_FAILURE);
+ } else {
+ /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
+ SIMIX_req_host_execution_destroy(task->simdata->compute);
+ simdata->comm = NULL;
+ simdata->compute = NULL;
+#ifdef HAVE_TRACING
+ TRACE_msg_task_execute_end(task);
+#endif
+ MSG_RETURN(MSG_TASK_CANCELLED);
+ }
+}