1 /* Authors: Arnaud Legrand */
3 /* This program is free software; you can redistribute it and/or modify it
4 under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "surf_private.h"
7 #include "cpu_private.h"
9 s_surf_global_t surf_global;
11 e_surf_action_state_t surf_action_get_state(surf_action_t action)
13 if(action->state_set == surf_global.ready_action_set)
14 return SURF_ACTION_READY;
15 if(action->state_set == surf_global.running_action_set)
16 return SURF_ACTION_RUNNING;
17 if(action->state_set == surf_global.failed_action_set)
18 return SURF_ACTION_FAILED;
19 if(action->state_set == surf_global.done_action_set)
20 return SURF_ACTION_DONE;
21 return SURF_ACTION_NOT_IN_THE_SYSTEM;
24 void surf_action_free(surf_action_t * action)
26 (*action)->resource_type->action_cancel(*action);
31 void surf_action_change_state(surf_action_t action, e_surf_action_state_t state)
33 xbt_swag_extract(action, action->state_set);
34 if(state == SURF_ACTION_READY)
35 action->state_set = surf_global.ready_action_set;
36 else if(state == SURF_ACTION_RUNNING)
37 action->state_set = surf_global.running_action_set;
38 else if(state == SURF_ACTION_FAILED)
39 action->state_set = surf_global.failed_action_set;
40 else if(state == SURF_ACTION_DONE)
41 action->state_set = surf_global.done_action_set;
42 else action->state_set = NULL;
44 if(action->state_set) xbt_swag_insert(action, action->state_set);
49 surf_cpu_resource = surf_cpu_resource_init();
52 /* xbt_heap_float_t surf_solve(void) */