- DEBUG1("**[%p]** Locking ****",context);
- pthread_mutex_lock(&(context->mutex));
- DEBUG1("**[%p]** Pthread create ****",context);
- xbt_assert0(!pthread_create(context->thread, NULL, __context_wrapper, context),"Unable to create a thread.");
- DEBUG2("**[%p]** Pthread created : %p ****",context,(void*)(*(context->thread)));
- DEBUG1("**[%p]** Going to jail ****",context);
- pthread_cond_wait(&(context->cond), &(context->mutex));
- DEBUG1("**[%p]** Unlocking ****",context);
- pthread_mutex_unlock(&(context->mutex));
- #elif defined(USE_WIN_THREADS)
- /* Launch the thread */
- DEBUG1("**[%p]** Locking ****",context);
- win_thread_mutex_lock(&(context->mutex));
- DEBUG1("**[%p]** Windows thread create ****",context);
- xbt_assert0(!win_thread_create(&(context->thread), __context_wrapper, context),"Unable to create a thread.");
- DEBUG2("**[%p]** Windows created : %p ****",context,(void*)(context->thread));
- DEBUG1("**[%p]** Going to jail ****",context);
- win_thread_cond_wait(&(context->cond), &(context->mutex));
- DEBUG1("**[%p]** Unlocking ****",context);
- win_thread_mutex_unlock(&(context->mutex));
+ DEBUG3("**[ctx:%p;self:%p]** Locking creation_mutex %p ****",context,xbt_os_thread_self(),creation_mutex);
+ xbt_os_mutex_lock(creation_mutex);
+
+ DEBUG2("**[ctx:%p;self:%p]** Thread create ****",context,xbt_os_thread_self());
+ context->thread = xbt_os_thread_create(__context_wrapper, context);
+ DEBUG3("**[ctx:%p;self:%p]** Thread created : %p ****",context,xbt_os_thread_self(),context->thread);
+
+ DEBUG4("**[ctx:%p;self:%p]** Going to jail on creation_cond/mutex (%p,%p) ****",
+ context,xbt_os_thread_self(),creation_cond, creation_mutex);
+ xbt_os_cond_wait(creation_cond, creation_mutex);
+ DEBUG3("**[ctx:%p;self:%p]** Unlocking creation %p ****",context, xbt_os_thread_self(),creation_mutex);
+ xbt_os_mutex_unlock(creation_mutex);