about summary refs log tree commit diff
path: root/nptl/descr.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-12-27 01:04:06 +0000
committerUlrich Drepper <drepper@redhat.com>2005-12-27 01:04:06 +0000
commit1bcfb5a5eb1c25b64a329c1edf6bcfb440cdbc93 (patch)
treeefa74fd1d0c2f6fccda616328a7b432ffdc6ba92 /nptl/descr.h
parent08f60b258ec9d9a24275831941a6f559eb26580e (diff)
downloadglibc-1bcfb5a5eb1c25b64a329c1edf6bcfb440cdbc93.tar.gz
glibc-1bcfb5a5eb1c25b64a329c1edf6bcfb440cdbc93.tar.xz
glibc-1bcfb5a5eb1c25b64a329c1edf6bcfb440cdbc93.zip
* Versions.def: Add GLIBC_2.4 for libpthread. cvs/fedora-glibc-20051227T1426
Diffstat (limited to 'nptl/descr.h')
-rw-r--r--nptl/descr.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/nptl/descr.h b/nptl/descr.h
index aaef9bc621..a9f830ef0b 100644
--- a/nptl/descr.h
+++ b/nptl/descr.h
@@ -134,6 +134,51 @@ struct pthread
   /* Process ID - thread group ID in kernel speak.  */
   pid_t pid;
 
+  /* List of robust mutexes the thread is holding.  */
+  pthread_mutex_t *robust_list;
+
+#ifdef __PTHREAD_MUTEX_HAVE_PREV
+# define ENQUEUE_MUTEX(mutex) \
+  do {									      \
+    mutex->__data.__next = THREAD_GETMEM (THREAD_SELF, robust_list);	      \
+    THREAD_SETMEM (THREAD_SELF, robust_list, mutex);			      \
+    if (mutex->__data.__next != NULL)					      \
+      mutex->__data.__next->__data.__prev = mutex;			      \
+    mutex->__data.__prev = NULL;					      \
+  } while (0)
+# define DEQUEUE_MUTEX(mutex) \
+  do {									      \
+    if (mutex->__data.__prev == NULL)					      \
+      THREAD_SETMEM (THREAD_SELF, robust_list, mutex->__data.__next);	      \
+    else								      \
+      mutex->__data.__prev->__data.__next = mutex->__data.__next;	      \
+    if (mutex->__data.__next != NULL)					      \
+      mutex->__data.__next->__data.__prev = mutex->__data.__prev;	      \
+    mutex->__data.__prev = NULL;					      \
+    mutex->__data.__next = NULL;					      \
+  } while (0)
+#else
+# define ENQUEUE_MUTEX(mutex) \
+  do {									      \
+    mutex->__data.__next = THREAD_GETMEM (THREAD_SELF, robust_list);	      \
+    THREAD_SETMEM (THREAD_SELF, robust_list, mutex);			      \
+  } while (0)
+# define DEQUEUE_MUTEX(mutex) \
+  do {									      \
+    pthread_mutex_t *runp = THREAD_GETMEM (THREAD_SELF, robust_list);	      \
+    if (runp == mutex)							      \
+      THREAD_SETMEM (THREAD_SELF, robust_list, runp->__data.__next);	      \
+    else								      \
+      {									      \
+	while (runp->__data.__next != mutex)				      \
+	  runp = runp->__data.__next;					      \
+									      \
+	runp->__data.__next = runp->__data.__next->__data.__next;	      \
+	mutex->__data.__next = NULL;					      \
+      }									      \
+  } while (0)
+#endif
+
   /* List of cleanup buffers.  */
   struct _pthread_cleanup_buffer *cleanup;