/************************** 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);
#include "private.h"
#include "xbt/log.h"
+#include "xbt/ex.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_action, simix,
"Logging specific to SIMIX (action)");
{
/* 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 */
{
/* 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 */
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);
* 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);
-
}
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) {
*/
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 */