Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed Mar 16, 2000
1 parent 8654617 commit ee5cda9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
6 changes: 0 additions & 6 deletions linuxthreads/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
2000-03-16 Ulrich Drepper <drepper@redhat.com>

* mutex.c (__pthread_mutex_lock): Always initialize __m_owner.
(__pthread_mutex_trylock): Likewise.
(__pthread_mutex_unlock): Always clear __m_owner.

2000-03-14 Ulrich Drepper <drepper@redhat.com>

* condvar.c (pthread_cond_wait): Check whether mutex is owned by
Expand Down
14 changes: 6 additions & 8 deletions linuxthreads/mutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -78,31 +77,31 @@ 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) {
mutex->__m_count++;
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)

Expand All @@ -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) {
Expand Down

0 comments on commit ee5cda9

Please sign in to comment.