about summary refs log tree commit diff
path: root/nptl/descr.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-02-13 01:27:41 +0000
committerUlrich Drepper <drepper@redhat.com>2006-02-13 01:27:41 +0000
commitb007ce7cc6971e4bd4cd91c558efd3d4603d941d (patch)
treeb8c327bb42fea490cfa5ea910fbab4ca73a404aa /nptl/descr.h
parentbbf209a4272252276215e2606746eb2d3c7a326e (diff)
downloadglibc-b007ce7cc6971e4bd4cd91c558efd3d4603d941d.tar.gz
glibc-b007ce7cc6971e4bd4cd91c558efd3d4603d941d.tar.xz
glibc-b007ce7cc6971e4bd4cd91c558efd3d4603d941d.zip
* allocatestack.c (allocate_stack): Initialize robust_list. cvs/fedora-glibc-20060213T0650
	* init.c (__pthread_initialize_minimal_internal): Likewise.
	* descr.h (struct xid_command): Pretty printing.
	(struct pthread): Use __pthread_list_t or __pthread_slist_t for
	robust_list.  Adjust macros.
	* pthread_create.c (start_thread): Adjust robust_list handling.
	* phtread_mutex_unlock.c: Don't allow unlocking from any thread
	but the owner for all robust mutex types.
	* sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h: Define
	__pthread_list_t and __pthread_slist_t.  Use them in pthread_mutex_t.
	* sysdeps/pthread/pthread.h: Adjust mutex initializers.
Diffstat (limited to 'nptl/descr.h')
-rw-r--r--nptl/descr.h43
1 files changed, 21 insertions, 22 deletions
diff --git a/nptl/descr.h b/nptl/descr.h
index 6dcc574c24..6984138537 100644
--- a/nptl/descr.h
+++ b/nptl/descr.h
@@ -97,7 +97,7 @@ struct pthread_unwind_buf
 struct xid_command
 {
   int syscall_no;
-  long id[3];
+  long int id[3];
   volatile int cntr;
 };
 
@@ -135,46 +135,45 @@ struct pthread
   pid_t pid;
 
   /* List of robust mutexes the thread is holding.  */
-  struct __pthread_mutex_s *robust_list;
-
 #ifdef __PTHREAD_MUTEX_HAVE_PREV
+  __pthread_list_t robust_list;
+
 # define ENQUEUE_MUTEX(mutex) \
   do {									      \
-    mutex->__data.__next = THREAD_GETMEM (THREAD_SELF, robust_list);	      \
-    THREAD_SETMEM (THREAD_SELF, robust_list, &mutex->__data);		      \
-    if (mutex->__data.__next != NULL)					      \
-      mutex->__data.__next->__prev = &mutex->__data;			      \
-    mutex->__data.__prev = NULL;					      \
+    __pthread_list_t *next = THREAD_GETMEM (THREAD_SELF, robust_list.__next); \
+    next->__prev = &mutex->__data.__list;				      \
+    mutex->__data.__list.__next = next;					      \
+    mutex->__data.__list.__prev = &THREAD_SELF->robust_list;		      \
+    THREAD_SETMEM (THREAD_SELF, robust_list.__next, &mutex->__data.__list);   \
   } 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->__next = mutex->__data.__next;		      \
-    if (mutex->__data.__next != NULL)					      \
-      mutex->__data.__next->__prev = mutex->__data.__prev;		      \
-    mutex->__data.__prev = NULL;					      \
-    mutex->__data.__next = NULL;					      \
+    mutex->__data.__list.__next->__prev = mutex->__data.__list.__prev;	      \
+    mutex->__data.__list.__prev->__next = mutex->__data.__list.__next;	      \
+    mutex->__data.__list.__prev = NULL;					      \
+    mutex->__data.__list.__next = NULL;					      \
   } while (0)
 #else
+  __pthread_slist_t robust_list;
+
 # define ENQUEUE_MUTEX(mutex) \
   do {									      \
-    mutex->__data.__next = THREAD_GETMEM (THREAD_SELF, robust_list);	      \
-    THREAD_SETMEM (THREAD_SELF, robust_list, &mutex->__data);		      \
+    mutex->__data.__list.__next						      \
+      = THREAD_GETMEM (THREAD_SELF, robust_list.__next);		      \
+    THREAD_SETMEM (THREAD_SELF, robust_list.__next, &mutex->__data.__list);   \
   } while (0)
 # define DEQUEUE_MUTEX(mutex) \
   do {									      \
-    struct __pthread_mutex_s *runp = THREAD_GETMEM (THREAD_SELF, robust_list);\
-    if (runp == &mutex->__data)						      \
+    __pthread_slist_t *runp = THREAD_GETMEM (THREAD_SELF, robust_list.__next);\
+    if (runp == &mutex->__data.__list)					      \
       THREAD_SETMEM (THREAD_SELF, robust_list, runp->__next);		      \
     else								      \
       {									      \
-	while (runp->__next != &mutex->__data)				      \
+	while (runp->__next != &mutex->__data.__list)			      \
 	  runp = runp->__next;						      \
 									      \
 	runp->__next = runp->__next->__next;				      \
-	mutex->__data.__next = NULL;					      \
+	mutex->__data.__list.__next = NULL;				      \
       }									      \
   } while (0)
 #endif