X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/83eac0d2fba299311b07779b4de686124ce0905b..2c8c164d58104acb6256b6d8efd476a6a2165b8a:/src/xbt/xbt_os_thread.c diff --git a/src/xbt/xbt_os_thread.c b/src/xbt/xbt_os_thread.c index 3ef350b355..78c47333eb 100644 --- a/src/xbt/xbt_os_thread.c +++ b/src/xbt/xbt_os_thread.c @@ -1,6 +1,6 @@ /* xbt_os_thread -- portability layer over the pthread API */ /* Used in RL to get win/lin portability, and in SG when CONTEXT_THREAD */ -/* in SG, when using CONTEXT_UCONTEXT, xbt_os_thread_stub is used instead */ +/* in SG, when using HAVE_UCONTEXT_CONTEXTS, xbt_os_thread_stub is used instead */ /* Copyright (c) 2007-2015. The SimGrid Team. * All rights reserved. */ @@ -103,10 +103,13 @@ void xbt_os_thread_mod_preinit(void) "pthread_key_create failed for xbt_self_thread_key"); main_thread = xbt_new(s_xbt_os_thread_t, 1); + main_thread->name = NULL; + main_thread->detached = 0; main_thread->name = (char *) "main"; - main_thread->start_routine = NULL; main_thread->param = NULL; + main_thread->start_routine = NULL; main_thread->running_ctx = xbt_new(xbt_running_ctx_t, 1); + main_thread->extra_data = NULL; XBT_RUNNING_CTX_INITIALIZE(main_thread->running_ctx); if ((errcode = pthread_setspecific(xbt_self_thread_key, main_thread))) @@ -1299,7 +1302,11 @@ void xbt_os_thread_set_extra_data(void *data) void *xbt_os_thread_get_extra_data(void) { - return xbt_os_thread_self()->extra_data; + xbt_os_thread_t thread = xbt_os_thread_self(); + if (thread) + return xbt_os_thread_self()->extra_data; + else + return NULL; } xbt_os_rmutex_t xbt_os_rmutex_init(void)