if(context->exception)
free(context->exception);
+ free(context->name);
free(context);
context = NULL;
}
xbt_context_t
-xbt_context_new(xbt_main_func_t code,
+xbt_context_new(const char *name, xbt_main_func_t code,
void_f_pvoid_t startup_func, void *startup_arg,
void_f_pvoid_t cleanup_func, void *cleanup_arg,
int argc, char *argv[]) {
xbt_context_t context = xbt_new0(s_xbt_context_t,1);
context->code = code;
+ context->name = xbt_strdup(name);
context->mutex = xbt_os_mutex_init();
context->cond = xbt_os_cond_init();
simdata->cond = NULL;
simdata->argc = argc;
simdata->argv = argv;
- simdata->context = xbt_context_new(code, NULL, NULL,
+ simdata->context = xbt_context_new(name,code, NULL, NULL,
simix_global->
cleanup_process_function, process,
simdata->argc, simdata->argv);
simdata->argc = 0;
simdata->argv = NULL;
- simdata->context = xbt_context_new(NULL, NULL, NULL,
+ simdata->context = xbt_context_new(name,NULL, NULL, NULL,
simix_global->
cleanup_process_function, process,
/* argc/argv */ 0, NULL);
rctx->end_time = -1;
rctx->reader_done = 0;
- rctx->reader = xbt_os_thread_create(thread_reader,(void*)rctx);
- rctx->writer = xbt_os_thread_create(thread_writer,(void*)rctx);
+ rctx->reader = xbt_os_thread_create("reader",thread_reader,(void*)rctx);
+ rctx->writer = xbt_os_thread_create("writer",thread_writer,(void*)rctx);
} else { /* child */
DEBUG2("RCTX: new bg=%p, new fg=%p",old,rctx);
DEBUG2("Launch a thread to wait for %s %d",old->cmd,old->pid);
- runner = xbt_os_thread_create(rctx_wait,(void*)old);
+ runner = xbt_os_thread_create(old->cmd,rctx_wait,(void*)old);
old->runner = runner;
VERB3("Launched thread %p to wait for %s %d",
runner,old->cmd, old->pid);