Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Return action state on SIMIX_req_host_execution_wait().
authorcristianrosa <cristianrosa@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 27 Jan 2011 13:59:26 +0000 (13:59 +0000)
committercristianrosa <cristianrosa@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 27 Jan 2011 13:59:26 +0000 (13:59 +0000)
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

include/simix/simix.h
src/msg/gos.c
src/simix/smurf_private.h
src/simix/smx_host.c
src/simix/smx_user.c

index a64306c..4d95ee6 100644 (file)
@@ -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 ********************************/
index 75aa084..46124d8 100644 (file)
@@ -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;
index 59fcf28..5f7dcb4 100644 (file)
@@ -209,6 +209,7 @@ typedef struct s_smx_req {
 
     struct {
       smx_action_t execution;
+      e_smx_state_t result;
     } host_execution_wait;
 
     struct {
index 65afb4f..13b216a 100644 (file)
@@ -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);
   }
 }
index 163a7d4..91921ef 100644 (file)
@@ -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;
 }
 
 /**