about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2000-07-31 15:31:21 +0000
committerAndreas Jaeger <aj@suse.de>2000-07-31 15:31:21 +0000
commit91856709da3e84e2d2b3addcb24815ba88f11cd7 (patch)
treedd500cc9097d4be8072c650f46c56aef9af8f49e
parent5e6d1c3fac1f3d92fb9f5351b2697d69d0f4ea5d (diff)
downloadglibc-91856709da3e84e2d2b3addcb24815ba88f11cd7.tar.gz
glibc-91856709da3e84e2d2b3addcb24815ba88f11cd7.tar.xz
glibc-91856709da3e84e2d2b3addcb24815ba88f11cd7.zip
* mutex.c (__pthread_mutex_trylock): Only set mutex owner if we
	really own it.
	Patch by Kevin B. Hendricks" <khendricks@ivey.uwo.ca>.
-rw-r--r--linuxthreads/ChangeLog6
-rw-r--r--linuxthreads/mutex.c3
2 files changed, 8 insertions, 1 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index b4bebf975b..2f2ab954d0 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,9 @@
+2000-07-31  Andreas Jaeger  <aj@suse.de>
+
+	* mutex.c (__pthread_mutex_trylock): Only set mutex owner if we
+	really own it.
+	Patch by Kevin B. Hendricks" <khendricks@ivey.uwo.ca>.
+
 2000-04-09  Ulrich Drepper  <drepper@redhat.com>
 
 	* signals.c (sigaction): Fix return value for the case SIG is one
diff --git a/linuxthreads/mutex.c b/linuxthreads/mutex.c
index 5f0b81b702..ed1e7607c1 100644
--- a/linuxthreads/mutex.c
+++ b/linuxthreads/mutex.c
@@ -50,7 +50,8 @@ 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();
+    if (retcode == 0)
+      mutex->__m_owner = thread_self();
     return retcode;
   case PTHREAD_MUTEX_RECURSIVE_NP:
     self = thread_self();