Make i386/tls.h more like the linux one
authorDavid Bartley <dtbartle@maltodextrin.csclub.uwaterloo.ca>
Tue, 26 Aug 2008 00:55:24 +0000 (00:55 +0000)
committerDavid Bartley <dtbartle@maltodextrin.csclub.uwaterloo.ca>
Tue, 26 Aug 2008 00:55:24 +0000 (00:55 +0000)
nptl/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/tls.h

index dbd369d..34cc918 100644 (file)
@@ -326,14 +326,17 @@ typedef struct
 /* Get and set the global scope generation counter in the TCB head.  */
 #define THREAD_GSCOPE_FLAG_UNUSED 0
 #define THREAD_GSCOPE_FLAG_USED   1
+#define THREAD_GSCOPE_FLAG_WAIT   2
 #define THREAD_GSCOPE_RESET_FLAG() \
-  do                                          \
-    { int __res;                                  \
-      asm volatile ("xchgl %0, %%gs:%P1"                      \
-            : "=r" (__res)                        \
-            : "i" (offsetof (struct pthread, header.gscope_flag)),    \
-              "0" (THREAD_GSCOPE_FLAG_UNUSED));               \
-    }                                         \
+  do                                                                         \
+    { int __res;                                                             \
+      asm volatile ("xchgl %0, %%gs:%P1"                                     \
+                   : "=r" (__res)                                            \
+                   : "i" (offsetof (struct pthread, header.gscope_flag)),    \
+                     "0" (THREAD_GSCOPE_FLAG_UNUSED));                       \
+      if (__res == THREAD_GSCOPE_FLAG_WAIT)                                  \
+       lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1, LLL_PRIVATE);    \
+    }                                                                        \
   while (0)
 #define THREAD_GSCOPE_SET_FLAG() \
   THREAD_SETMEM (THREAD_SELF, header.gscope_flag, THREAD_GSCOPE_FLAG_USED)