*/
smx_process_t SIMIX_process_create(const char *name,
xbt_main_func_t code, void *data,
- const char * hostname, int argc, char **argv,
- void * clean_process_function)
+ const char * hostname, int argc, char **argv)
{
smx_simdata_process_t simdata = xbt_new0(s_smx_simdata_process_t,1);
smx_process_t process = xbt_new0(s_smx_process_t,1);
simdata->cond = NULL;
simdata->argc = argc;
simdata->argv = argv;
- if (clean_process_function) {
- simdata->context = xbt_context_new(code, NULL, NULL,
- clean_process_function, process,
- simdata->argc, simdata->argv);
- }
- else {
- simdata->context = xbt_context_new(code, NULL, NULL,
- SIMIX_process_cleanup, process,
- simdata->argc, simdata->argv);
- }
+ simdata->context = xbt_context_new(code, NULL, NULL,
+ simix_global->cleanup_process_function, process,
+ simdata->argc, simdata->argv);
/* Process structure */
process->name = xbt_strdup(name);
void SIMIX_jprocess_create(const char *name, smx_host_t host,
void *data,
void *jprocess, void *jenv,
- void *clean_process_function,
smx_process_t *res)
{
smx_simdata_process_t simdata = xbt_new0(s_smx_simdata_process_t,1);
simdata->argc = 0;
simdata->argv = NULL;
- if (clean_process_function) {
- simdata->context = xbt_context_new(NULL, NULL, NULL,
- clean_process_function, process,
- /* argc/argv*/0,NULL);
- } else {
- simdata->context = xbt_context_new(NULL, NULL, NULL,
- SIMIX_process_cleanup, process,
- /* argc/argv*/0,NULL);
- }
+ simdata->context = xbt_context_new(NULL, NULL, NULL,
+ simix_global->cleanup_process_function, process,
+ /* argc/argv*/0,NULL);
/* Process structure */
process->name = xbt_strdup(name);
DEBUG2("Killing process %s on %s",process->name, p_simdata->s_host->name);
/* Cleanup if we were waiting for something */
+ DEBUG0("Here!");
if (p_simdata->mutex)
xbt_swag_remove(process,p_simdata->mutex->sleeping);
+ DEBUG0("Here!");
if (p_simdata->cond)
xbt_swag_remove(process,p_simdata->cond->sleeping);
+ DEBUG0("Here!");
xbt_swag_remove(process, simix_global->process_to_run);
+ DEBUG0("Here!");
xbt_swag_remove(process, simix_global->process_list);
+ DEBUG2("%p here! killing %p",simix_global->current_process,process);
xbt_context_kill(process->simdata->context);
+ DEBUG0("Here!");
if(process==SIMIX_process_self()) {
/* I just killed myself */
+ DEBUG0("Here!");
xbt_context_yield();
}
+ DEBUG0("Here!");
}
/**
void SIMIX_process_set_data(smx_process_t process,void *data)
{
xbt_assert0((process != NULL), "Invalid parameters");
- xbt_assert0((process->data == NULL), "Data already set");
+ //xbt_assert0((process->data == NULL), "Data already set");
process->data = data;