From 09e967c2d732783b2579e4e120cd9b608404cb00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwenol=C3=A9=20Beauchesne?= Date: Wed, 4 Jun 2003 18:31:57 +0000 Subject: Merge from R9_0-AMD64, most notably: - AMD64 support to insmod-busybox, minilibc, et al. - Sync with insmod-modutils 2.4.19 something but everyone should use dietlibc nowadays - Factor out compilation and prefix with $(DIET) for dietlibc builds - 64-bit & varargs fixes --- mdk-stage1/dietlibc/libpthread/pthread_mutex_lock.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'mdk-stage1/dietlibc/libpthread/pthread_mutex_lock.c') diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutex_lock.c b/mdk-stage1/dietlibc/libpthread/pthread_mutex_lock.c index 0c3ade9e8..0df2bcd8d 100644 --- a/mdk-stage1/dietlibc/libpthread/pthread_mutex_lock.c +++ b/mdk-stage1/dietlibc/libpthread/pthread_mutex_lock.c @@ -15,19 +15,18 @@ int pthread_mutex_lock(pthread_mutex_t *mutex) this = __thread_self(); - if (this!=mutex->owner) { - /* wait for mutex to free */ - __pthread_lock(&(mutex->lock)); - - mutex->owner=this; - } - else if (mutex->kind==PTHREAD_MUTEX_ERRORCHECK_NP) - { - (*(__errno_location()))=EDEADLK; - return -1; + if (this==mutex->owner) { + if (mutex->kind==PTHREAD_MUTEX_ERRORCHECK_NP) + return EDEADLK; + if (mutex->kind==PTHREAD_MUTEX_RECURSIVE_NP) { + ++(mutex->count); + return 0; + } } - if (mutex->kind==PTHREAD_MUTEX_RECURSIVE_NP) ++(mutex->count); + /* wait for mutex to free */ + __pthread_lock(&(mutex->lock)); + mutex->owner=this; return 0; } -- cgit v1.2.1