X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/21470e468f3d83143e8c553967867e64130e12e6..ca630f35f5db5b14af66fef9902f47f5f382b1fc:/src/surf/cpu.c diff --git a/src/surf/cpu.c b/src/surf/cpu.c index 604786609c..3814631308 100644 --- a/src/surf/cpu.c +++ b/src/surf/cpu.c @@ -14,11 +14,12 @@ surf_cpu_model_t surf_cpu_model = NULL; lmm_system_t cpu_maxmin_system = NULL; xbt_dict_t cpu_set = NULL; -xbt_swag_t running_action_set_that_does_not_need_being_checked = NULL; +static xbt_swag_t running_action_set_that_does_not_need_being_checked = NULL; static void cpu_free(void *cpu) { free(((cpu_Cas01_t) cpu)->name); + xbt_dict_free(&(((cpu_Cas01_t)cpu)->properties)); free(cpu); } @@ -125,9 +126,6 @@ static void define_callbacks(const char *file) { surf_parse_reset_parser(); surfxml_add_callback(STag_surfxml_host_cb_list, parse_cpu_init); - surfxml_add_callback(STag_surfxml_prop_cb_list, parse_properties); - surfxml_add_callback(STag_surfxml_random_cb_list, &init_randomness); - surfxml_add_callback(ETag_surfxml_random_cb_list, &add_randomness); } static void *name_service(const char *name) @@ -148,8 +146,8 @@ static int resource_used(void *resource_id) static int action_free(surf_action_t action) { - action->using--; - if (!action->using) { + action->refcount --; + if (!action->refcount ) { xbt_swag_remove(action, action->state_set); if (((surf_action_cpu_Cas01_t) action)->variable) lmm_variable_free(cpu_maxmin_system, @@ -162,7 +160,7 @@ static int action_free(surf_action_t action) static void action_use(surf_action_t action) { - action->using++; + action->refcount ++; } static void action_cancel(surf_action_t action) @@ -275,7 +273,7 @@ static surf_action_t execute(void *cpu, double size) XBT_IN2("(%s,%g)", CPU->name, size); action = xbt_new0(s_surf_action_cpu_Cas01_t, 1); - action->generic_action.using = 1; + action->generic_action.refcount = 1; action->generic_action.cost = size; action->generic_action.remains = size; action->generic_action.priority = 1.0; @@ -405,6 +403,8 @@ static void finalize(void) xbt_swag_free(surf_cpu_model->common_public->states. failed_action_set); xbt_swag_free(surf_cpu_model->common_public->states.done_action_set); + xbt_swag_free(running_action_set_that_does_not_need_being_checked); + running_action_set_that_does_not_need_being_checked = NULL; free(surf_cpu_model->common_public); free(surf_cpu_model->common_private); free(surf_cpu_model->extension_public);