about summary refs log tree commit diff
path: root/nptl/pthread_mutex_lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/pthread_mutex_lock.c')
-rw-r--r--nptl/pthread_mutex_lock.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c
index 4fdb13718c..9c61aa75f6 100644
--- a/nptl/pthread_mutex_lock.c
+++ b/nptl/pthread_mutex_lock.c
@@ -31,7 +31,7 @@ int
 __pthread_mutex_lock (mutex)
      pthread_mutex_t *mutex;
 {
-  struct pthread *id = THREAD_ID;
+  pid_t id = THREAD_GETMEM (THREAD_SELF, tid);
 
   switch (__builtin_expect (mutex->__data.__kind, PTHREAD_MUTEX_TIMED_NP))
     {
@@ -55,6 +55,9 @@ __pthread_mutex_lock (mutex)
 	  /* Record the ownership.  */
 	  mutex->__data.__owner = id;
 	  mutex->__data.__count = 1;
+#ifndef NO_INCR
+	  ++mutex->__data.__nusers;
+#endif
 	}
       break;
 
@@ -74,6 +77,9 @@ __pthread_mutex_lock (mutex)
       LLL_MUTEX_LOCK (mutex->__data.__lock);
       /* Record the ownership.  */
       mutex->__data.__owner = id;
+#ifndef NO_INCR
+      ++mutex->__data.__nusers;
+#endif
       break;
     }