From: Frederic Suter Date: Thu, 9 Mar 2017 12:53:37 +0000 (+0100) Subject: internal dynar-- X-Git-Tag: v3_15~174 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/04f2226028a38d3e30f5d7d30ef53b7274f34cca internal dynar-- --- diff --git a/src/simix/ActorImpl.cpp b/src/simix/ActorImpl.cpp index 403a5c29e2..970ececb15 100644 --- a/src/simix/ActorImpl.cpp +++ b/src/simix/ActorImpl.cpp @@ -166,7 +166,6 @@ ActorImpl::~ActorImpl() { delete this->context; xbt_dict_free(&this->properties); - xbt_dynar_free(&this->on_exit); } void create_maestro(std::function code) @@ -857,22 +856,19 @@ xbt_dynar_t SIMIX_processes_as_dynar() { void SIMIX_process_on_exit_runall(smx_actor_t process) { s_smx_process_exit_fun_t exit_fun; smx_process_exit_status_t exit_status = (process->context->iwannadie) ? SMX_EXIT_FAILURE : SMX_EXIT_SUCCESS; - while (!xbt_dynar_is_empty(process->on_exit)) { - exit_fun = xbt_dynar_pop_as(process->on_exit,s_smx_process_exit_fun_t); + while (!process->on_exit.empty()) { + exit_fun = process->on_exit.back(); (exit_fun.fun)((void*)exit_status, exit_fun.arg); + process->on_exit.pop_back(); } } void SIMIX_process_on_exit(smx_actor_t process, int_f_pvoid_pvoid_t fun, void *data) { xbt_assert(process, "current process not found: are you in maestro context ?"); - if (!process->on_exit) { - process->on_exit = xbt_dynar_new(sizeof(s_smx_process_exit_fun_t), nullptr); - } - s_smx_process_exit_fun_t exit_fun = {fun, data}; - xbt_dynar_push_as(process->on_exit,s_smx_process_exit_fun_t,exit_fun); + process->on_exit.push_back(exit_fun); } /** diff --git a/src/simix/ActorImpl.hpp b/src/simix/ActorImpl.hpp index 5986a190ee..c7ce8cd171 100644 --- a/src/simix/ActorImpl.hpp +++ b/src/simix/ActorImpl.hpp @@ -60,7 +60,7 @@ public: xbt_dict_t properties = nullptr; s_smx_simcall_t simcall; void *data = nullptr; /* kept for compatibility, it should be replaced with moddata */ - xbt_dynar_t on_exit = nullptr; /* list of functions executed when the process dies */ + std::vector on_exit; /* list of functions executed when the process dies */ std::function code; smx_timer_t kill_timer = nullptr;