host->name);
}
- action = xbt_new0(s_smx_action_t, 1);
+ action = xbt_mallocator_get(simix_global->action_mallocator);
action->type = SIMIX_ACTION_SLEEP;
- action->request_list = xbt_fifo_new();
- action->name = xbt_strdup("sleep");
+ action->name = NULL;
#ifdef HAVE_TRACING
action->category = NULL;
#endif
void SIMIX_post_process_sleep(smx_action_t action)
{
- e_smx_state_t state = SIMIX_action_map_state(surf_workstation_model->action_state_get(action->sleep.surf_sleep));
smx_req_t req;
+ e_smx_state_t state;
while ((req = xbt_fifo_shift(action->request_list))) {
+
+ switch(surf_workstation_model->action_state_get(action->sleep.surf_sleep)){
+ case SURF_ACTION_FAILED:
+ state = SIMIX_SRC_HOST_FAILURE;
+ break;
+
+ case SURF_ACTION_DONE:
+ state = SIMIX_DONE;
+ break;
+
+ default:
+ THROW_IMPOSSIBLE;
+ break;
+ }
req->process_sleep.result = state;
req->issuer->waiting_action = NULL;
SIMIX_request_answer(req);
}
-
SIMIX_process_sleep_destroy(action);
}
void SIMIX_process_sleep_destroy(smx_action_t action)
{
DEBUG1("Destroy action %p", action);
- if (action->name)
- xbt_free(action->name);
if (action->sleep.surf_sleep)
action->sleep.surf_sleep->model_type->action_unref(action->sleep.surf_sleep);
#ifdef HAVE_TRACING
TRACE_smx_action_destroy(action);
#endif
- xbt_fifo_free(action->request_list);
- xbt_free(action);
+ xbt_mallocator_release(simix_global->action_mallocator, action);
}
void SIMIX_process_sleep_suspend(smx_action_t action)