From: mquinson Date: Fri, 16 Mar 2007 14:08:48 +0000 (+0000) Subject: Kill a deadlock in the new thread creation code I've introduced (sometimes, the main... X-Git-Tag: v3.3~2059 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/21ec591fc56c559be671e8604a5f2332bcd2f9d6 Kill a deadlock in the new thread creation code I've introduced (sometimes, the main thread had the ability to acquire the individual lock of the created one before the poor dude got a chance to go in jail) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3300 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/xbt/context.c b/src/xbt/context.c index b24922a20c..0cfcb36eff 100644 --- a/src/xbt/context.c +++ b/src/xbt/context.c @@ -187,13 +187,13 @@ __context_wrapper(void* c) { DEBUG2("**[%p:%p]** Lock ****",context,(void*)xbt_thread_self()); xbt_mutex_lock(creation_mutex); + xbt_mutex_lock(context->mutex); DEBUG2("**[%p:%p]** Releasing the creator ****",context,(void*)xbt_thread_self()); xbt_thcond_signal(creation_cond); xbt_mutex_unlock(creation_mutex); DEBUG2("**[%p:%p]** Going to Jail ****",context,(void*)xbt_thread_self()); - xbt_mutex_lock(context->mutex); xbt_thcond_wait(context->cond, context->mutex); DEBUG2("**[%p:%p]** Unlocking ****",context,(void*)xbt_thread_self());