X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/945f379f0d3d7f8e923ee114de2e492e1cb5486f..3cc9325535240d20ab9eab51ad116889b53bf20e:/src/xbt/xbt_sg_synchro.c diff --git a/src/xbt/xbt_sg_synchro.c b/src/xbt/xbt_sg_synchro.c index 45ec409a1d..09e89619eb 100644 --- a/src/xbt/xbt_sg_synchro.c +++ b/src/xbt/xbt_sg_synchro.c @@ -21,8 +21,9 @@ /* the implementation would be cleaner (and faster) with ELF symbol aliasing */ typedef struct s_xbt_thread_ { + char *name; smx_process_t s_process; - void_f_pvoid_t *code; + void_f_pvoid_t code; void *userparam; void *father_data; } s_xbt_thread_t; @@ -34,18 +35,30 @@ static int xbt_thread_create_wrapper(int argc, char *argv[]) { return 0; } -xbt_thread_t xbt_thread_create(void_f_pvoid_t* code, void* param) { +xbt_thread_t xbt_thread_create(const char*name,void_f_pvoid_t code, void* param) { xbt_thread_t res = xbt_new0(s_xbt_thread_t,1); + res->name = xbt_strdup(name); res->userparam = param; res->code = code; - res->father_data = SIMIX_process_get_data(SIMIX_process_self()); - res->s_process = SIMIX_process_create(NULL, + res->father_data = SIMIX_process_get_data(SIMIX_process_self()); +// char*name = bprintf("%s#%p",SIMIX_process_get_name(SIMIX_process_self()), param); + res->s_process = SIMIX_process_create(name, xbt_thread_create_wrapper, res, SIMIX_host_get_name(SIMIX_host_self()), 0, NULL); +// free(name); return res; } +const char* xbt_thread_name(xbt_thread_t t) { + return t->name; +} + +const char* xbt_thread_self_name(void) { + return xbt_thread_self()->name; +} + + void xbt_thread_join(xbt_thread_t thread) { THROW_UNIMPLEMENTED; /* FIXME */