From: cristianrosa Date: Thu, 27 Jan 2011 13:59:26 +0000 (+0000) Subject: Return action state on SIMIX_req_host_execution_wait(). X-Git-Tag: v3.6_beta2~410 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/37c3311044fe215372be2a6075b82dba65ac5b1a Return action state on SIMIX_req_host_execution_wait(). This avoids a call to SIMIX_req_host_execution_get_state right afterwards. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9519 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/include/simix/simix.h b/include/simix/simix.h index a64306cd7d..4d95ee6b07 100644 --- a/include/simix/simix.h +++ b/include/simix/simix.h @@ -112,7 +112,7 @@ XBT_PUBLIC(void) SIMIX_req_host_execution_cancel(smx_action_t execution); XBT_PUBLIC(double) SIMIX_req_host_execution_get_remains(smx_action_t execution); XBT_PUBLIC(e_smx_state_t) SIMIX_req_host_execution_get_state(smx_action_t execution); XBT_PUBLIC(void) SIMIX_req_host_execution_set_priority(smx_action_t execution, double priority); -XBT_PUBLIC(void) SIMIX_req_host_execution_wait(smx_action_t execution); +XBT_PUBLIC(e_smx_state_t) SIMIX_req_host_execution_wait(smx_action_t execution); /**************************** Process Requests ********************************/ diff --git a/src/msg/gos.c b/src/msg/gos.c index 75aa0841f2..46124d84d0 100644 --- a/src/msg/gos.c +++ b/src/msg/gos.c @@ -38,6 +38,7 @@ MSG_error_t MSG_task_execute(m_task_t task) { simdata_task_t simdata = NULL; m_process_t self = MSG_process_self(); + e_smx_state_t comp_state; CHECK_HOST(); simdata = task->simdata; @@ -71,13 +72,13 @@ MSG_error_t MSG_task_execute(m_task_t task) #endif self->simdata->waiting_action = simdata->compute; - SIMIX_req_host_execution_wait(simdata->compute); + comp_state = 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) { + DEBUG2("Execution task '%s' finished in state %d", task->name, comp_state); + if (comp_state == 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; diff --git a/src/simix/smurf_private.h b/src/simix/smurf_private.h index 59fcf28c02..5f7dcb407e 100644 --- a/src/simix/smurf_private.h +++ b/src/simix/smurf_private.h @@ -209,6 +209,7 @@ typedef struct s_smx_req { struct { smx_action_t execution; + e_smx_state_t result; } host_execution_wait; struct { diff --git a/src/simix/smx_host.c b/src/simix/smx_host.c index 65afb4ff7c..13b216acac 100644 --- a/src/simix/smx_host.c +++ b/src/simix/smx_host.c @@ -371,6 +371,7 @@ void SIMIX_execution_finish(smx_action_t action) THROW_IMPOSSIBLE; } req->issuer->waiting_action = NULL; + req->host_execution_wait.result = action->state; SIMIX_request_answer(req); } } diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index 163a7d47f8..91921efae9 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -283,13 +283,14 @@ void SIMIX_req_host_execution_set_priority(smx_action_t execution, double priori * * \param execution The execution action */ -void SIMIX_req_host_execution_wait(smx_action_t execution) +e_smx_state_t SIMIX_req_host_execution_wait(smx_action_t execution) { smx_req_t req = SIMIX_req_mine(); req->call = REQ_HOST_EXECUTION_WAIT; req->host_execution_wait.execution = execution; SIMIX_request_push(); + return req->host_execution_wait.result; } /**