From d80e7348ea40daf2c7447e23d959fb167cffeb36 Mon Sep 17 00:00:00 2001 From: donassbr Date: Wed, 21 Mar 2007 14:50:31 +0000 Subject: [PATCH] Changes in the functions, correct prototype function (SIMIX_config) and change exception raised in SIMIX_action. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3322 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/include/simix/simix.h | 2 +- src/simix/smx_action.c | 15 +++++++++++---- src/simix/smx_config.c | 8 +------- src/simix/smx_process.c | 8 +++++++- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/include/simix/simix.h b/src/include/simix/simix.h index 0ccb914ff9..04a8816bd4 100644 --- a/src/include/simix/simix.h +++ b/src/include/simix/simix.h @@ -17,7 +17,7 @@ SG_BEGIN_DECL() /************************** Global ******************************************/ -XBT_PUBLIC(void) SIMIX_config(const char *name, ...); +XBT_PUBLIC(void) SIMIX_config(const char *name, va_list pa); XBT_PUBLIC(void) SIMIX_global_init(int *argc, char **argv); XBT_PUBLIC(void) SIMIX_global_init_args(int *argc, char **argv); XBT_PUBLIC(void) SIMIX_clean(void); diff --git a/src/simix/smx_action.c b/src/simix/smx_action.c index ac4560010b..0854c393e8 100644 --- a/src/simix/smx_action.c +++ b/src/simix/smx_action.c @@ -8,6 +8,7 @@ #include "private.h" #include "xbt/log.h" +#include "xbt/ex.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_action, simix, "Logging specific to SIMIX (action)"); @@ -18,10 +19,10 @@ smx_action_t SIMIX_action_communicate(smx_host_t sender,smx_host_t receiver,char { /* check if the host is active */ if ( surf_workstation_resource->extension_public->get_state(sender->simdata->host)!=SURF_CPU_ON) { - THROW1(1,1,"Host %s failed, you cannot call this function",sender->name); + THROW1(network_error,0,"Host %s failed, you cannot call this function",sender->name); } if ( surf_workstation_resource->extension_public->get_state(receiver->simdata->host)!=SURF_CPU_ON) { - THROW1(1,1,"Host %s failed, you cannot call this function",receiver->name); + THROW1(network_error,0,"Host %s failed, you cannot call this function",receiver->name); } /* alloc structures */ @@ -46,7 +47,7 @@ smx_action_t SIMIX_action_execute(smx_host_t host, char * name, double amount) { /* check if the host is active */ if ( surf_workstation_resource->extension_public->get_state(host->simdata->host)!=SURF_CPU_ON) { - THROW1(1,1,"Host %s failed, you cannot call this function",host->name); + THROW1(host_error,0,"Host %s failed, you cannot call this function",host->name); } /* alloc structures */ @@ -70,8 +71,14 @@ smx_action_t SIMIX_action_execute(smx_host_t host, char * name, double amount) smx_action_t SIMIX_action_sleep(smx_host_t host, double duration) -{ +{ char name[] = "sleep"; + + /* check if the host is active */ + if ( surf_workstation_resource->extension_public->get_state(host->simdata->host)!=SURF_CPU_ON) { + THROW1(host_error,0,"Host %s failed, you cannot call this function",host->name); + } + /* alloc structures */ smx_action_t act = xbt_new0(s_smx_action_t,1); act->simdata = xbt_new0(s_simdata_action_t,1); diff --git a/src/simix/smx_config.c b/src/simix/smx_config.c index 569cea1324..c71efecd3d 100644 --- a/src/simix/smx_config.c +++ b/src/simix/smx_config.c @@ -68,16 +68,10 @@ void simix_config_finalize(void) * Example: * MSG_config("surf_workstation_model","KCCFLN05"); */ -void SIMIX_config(const char *name, ...) +void SIMIX_config(const char *name, va_list pa) { - va_list pa; - if (!_simix_init_status) { simix_config_init(); } - - va_start(pa,name); xbt_cfg_set_vargs(_simix_cfg_set,name,pa); - va_end(pa); - } diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index 9c65d07a75..5a5807b1bb 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -129,6 +129,12 @@ void SIMIX_process_kill(smx_process_t process) DEBUG2("Killing %s on %s",process->name, p_simdata->host->name); + if (p_simdata->mutex) { + xbt_swag_remove(process,p_simdata->mutex->sleeping); + } + if (p_simdata->cond) { + xbt_swag_remove(process,p_simdata->cond->sleeping); + } /* if(p_simdata->waiting_task) { @@ -156,7 +162,7 @@ void SIMIX_process_kill(smx_process_t process) */ xbt_swag_remove(process,simix_global->process_to_run); xbt_swag_remove(process,simix_global->process_list); - xbt_context_free(process->simdata->context); + xbt_context_kill(process->simdata->context); if(process==SIMIX_process_self()) { /* I just killed myself */ -- 2.20.1