aboutsummaryrefslogtreecommitdiff
path: root/linuxthreads/mutex.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-03-16 21:42:07 +0000
committerUlrich Drepper <drepper@redhat.com>2000-03-16 21:42:07 +0000
commitee5cda9b439296ed761c77891dfe2f2f3ab47971 (patch)
treec1ad4ce00a80be0fe94fff2e5652a8f9f7e2ec4d /linuxthreads/mutex.c
parent865461779191a9aba07bc538be5f75931ea48221 (diff)
downloadglibc-ee5cda9b439296ed761c77891dfe2f2f3ab47971.zip
glibc-ee5cda9b439296ed761c77891dfe2f2f3ab47971.tar.gz
glibc-ee5cda9b439296ed761c77891dfe2f2f3ab47971.tar.bz2
Update.
Diffstat (limited to 'linuxthreads/mutex.c')
-rw-r--r--linuxthreads/mutex.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/linuxthreads/mutex.c b/linuxthreads/mutex.c
index 81a95ce..06d97df 100644
--- a/linuxthreads/mutex.c
+++ b/linuxthreads/mutex.c
@@ -50,7 +50,6 @@ int __pthread_mutex_trylock(pthread_mutex_t * mutex)
switch(mutex->__m_kind) {
case PTHREAD_MUTEX_FAST_NP:
retcode = __pthread_trylock(&mutex->__m_lock);
- mutex->__m_owner = thread_self();
return retcode;
case PTHREAD_MUTEX_RECURSIVE_NP:
self = thread_self();
@@ -78,12 +77,12 @@ strong_alias (__pthread_mutex_trylock, pthread_mutex_trylock)
int __pthread_mutex_lock(pthread_mutex_t * mutex)
{
- pthread_descr self = thread_self();
+ pthread_descr self;
switch(mutex->__m_kind) {
case PTHREAD_MUTEX_FAST_NP:
__pthread_lock(&mutex->__m_lock, NULL);
- break;
+ return 0;
case PTHREAD_MUTEX_RECURSIVE_NP:
self = thread_self();
if (mutex->__m_owner == self) {
@@ -91,18 +90,18 @@ int __pthread_mutex_lock(pthread_mutex_t * mutex)
return 0;
}
__pthread_lock(&mutex->__m_lock, self);
+ mutex->__m_owner = self;
mutex->__m_count = 0;
- break;
+ return 0;
case PTHREAD_MUTEX_ERRORCHECK_NP:
self = thread_self();
if (mutex->__m_owner == self) return EDEADLK;
__pthread_lock(&mutex->__m_lock, self);
- break;
+ mutex->__m_owner = self;
+ return 0;
default:
return EINVAL;
}
- mutex->__m_owner = self;
- return 0;
}
strong_alias (__pthread_mutex_lock, pthread_mutex_lock)
@@ -111,7 +110,6 @@ int __pthread_mutex_unlock(pthread_mutex_t * mutex)
switch (mutex->__m_kind) {
case PTHREAD_MUTEX_FAST_NP:
__pthread_unlock(&mutex->__m_lock);
- mutex->__m_owner = NULL;
return 0;
case PTHREAD_MUTEX_RECURSIVE_NP:
if (mutex->__m_count > 0) {