From 9a7178d611c8a9b2089cbd8288b623ec3e86da3f Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 1 May 2003 23:19:51 +0000 Subject: Update. 2003-05-01 Ulrich Drepper * sysdeps/i386/tls.h: Define THREAD_ID. * sysdeps/ia64/tls.h: Likewise. * sysdeps/powerpc/tls.h: Likewise. * sysdeps/s390/tls.h: Likewise. * sysdeps/sh/tls.h: Likewise. * sysdeps/x86_64/tls.h: Likewise. * pthread_mutex_lock.c: Use THREAD_ID instead of THREAD_SELF to record ownership. * pthread_mutex_timedlock.c: Likewise. * pthread_mutex_trylock.c: Likewise. * pthread_mutex_unlock.c: Likewise. * pthread_rwlock_trywrlock.c: Likewise. * sysdeps/pthread/pthread_rwlocklock_rdlock.c: Likewise. * sysdeps/pthread/pthread_rwlock_timedrdlock.c: Likewise. * sysdeps/pthread/pthread_rwlock_timedwrlock.c: Likewise. * sysdeps/pthread/pthread_rwlock_wrlock.c: Likewise. * sysdeps/pthread/createthread.c (create_thread): Use CLONE_SYSVSEM flag. --- nptl/pthread_mutex_unlock.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'nptl/pthread_mutex_unlock.c') diff --git a/nptl/pthread_mutex_unlock.c b/nptl/pthread_mutex_unlock.c index 3595585a84..975127d2b2 100644 --- a/nptl/pthread_mutex_unlock.c +++ b/nptl/pthread_mutex_unlock.c @@ -30,23 +30,19 @@ __pthread_mutex_unlock (mutex) { case PTHREAD_MUTEX_RECURSIVE_NP: /* Recursive mutex. */ - if (mutex->__data.__owner != THREAD_SELF) + if (mutex->__data.__owner != THREAD_ID) return EPERM; if (--mutex->__data.__count != 0) /* We still hold the mutex. */ return 0; - - mutex->__data.__owner = NULL; break; case PTHREAD_MUTEX_ERRORCHECK_NP: /* Error checking mutex. */ - if (mutex->__data.__owner != THREAD_SELF + if (mutex->__data.__owner != THREAD_ID || ! lll_mutex_islocked (mutex->__data.__lock)) return EPERM; - - mutex->__data.__owner = NULL; break; default: @@ -57,6 +53,9 @@ __pthread_mutex_unlock (mutex) break; } + /* Always reset the owner field. */ + mutex->__data.__owner = NULL; + /* Unlock. */ lll_mutex_unlock (mutex->__data.__lock); -- cgit 1.4.1