about summary refs log tree commit diff
path: root/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-06-05 19:31:57 +0000
committerUlrich Drepper <drepper@redhat.com>2003-06-05 19:31:57 +0000
commit4ad0bbf4fa2073b8b2cb81866f68ff3e8c503174 (patch)
tree3b1ca4ddea994a1978a4c1b1a791f8458cce706d /nptl/sysdeps/pthread/pthread_rwlock_wrlock.c
parentb558fd3ab7b8d9d98b7babc51da7de109f69a77e (diff)
downloadglibc-4ad0bbf4fa2073b8b2cb81866f68ff3e8c503174.tar.gz
glibc-4ad0bbf4fa2073b8b2cb81866f68ff3e8c503174.tar.xz
glibc-4ad0bbf4fa2073b8b2cb81866f68ff3e8c503174.zip
Update.
2003-06-05  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h (pthread_rwlock_t):
	Change type of __writer element to int.
	* sysdeps/unix/sysv/linux/ia64/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h: Likewise.
	* sysdeps/i386/tcb-offsets.sym: Replace SELF entry with TID entry.
	* sysdeps/x86_64/tcb-offsets.sym: Likewise.
	* pthread_rwlock_trywrlock.c: Store TID not self pointer in __writer.
	Compare with TID to determine deadlocks.
	* sysdeps/pthread/pthread_rwlock_rdlock.c: Likewise.
	* sysdeps/pthread/pthread_rwlock_timedrdlock.c: Likewise.
	* sysdeps/pthread/pthread_rwlock_timedwrlock.: Likewise.
	* sysdeps/pthread/pthread_rwlock_wrlock.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S:
	Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S:
	Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S:
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S:
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S: Likewise.
	* Makefile (tests): Add tst-rwlock12.
	* tst-rwlock12.c: New file.
Diffstat (limited to 'nptl/sysdeps/pthread/pthread_rwlock_wrlock.c')
-rw-r--r--nptl/sysdeps/pthread/pthread_rwlock_wrlock.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c b/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c
index 171a14adb1..822aeed79c 100644
--- a/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c
+++ b/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c
@@ -40,15 +40,14 @@ __pthread_rwlock_wrlock (rwlock)
       if (rwlock->__data.__writer == 0 && rwlock->__data.__nr_readers == 0)
 	{
 	  /* Mark self as writer.  */
-	  rwlock->__data.__writer = (pthread_t) THREAD_ID;
+	  rwlock->__data.__writer = THREAD_GETMEM (THREAD_SELF, tid);
 	  break;
 	}
 
       /* Make sure we are not holding the rwlock as a writer.  This is
 	 a deadlock situation we recognize and report.  */
-      if (rwlock->__data.__writer != 0
-	  && __builtin_expect (rwlock->__data.__writer
-			       == (pthread_t) THREAD_ID, 0))
+      if (__builtin_expect (rwlock->__data.__writer
+			    == THREAD_GETMEM (THREAD_SELF, tid), 0))
 	{
 	  result = EDEADLK;
 	  break;