summary refs log tree commit diff
path: root/sysdeps/mach/hurd/tls.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach/hurd/tls.h')
-rw-r--r--sysdeps/mach/hurd/tls.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/sysdeps/mach/hurd/tls.h b/sysdeps/mach/hurd/tls.h
index faff87c7b5..67c657b655 100644
--- a/sysdeps/mach/hurd/tls.h
+++ b/sysdeps/mach/hurd/tls.h
@@ -27,6 +27,7 @@
 # include <sysdep.h>
 # include <mach/mig_errors.h>
 # include <mach.h>
+# include <atomic.h>
 
 
 /* This is the size of the initial TCB.  */
@@ -51,6 +52,26 @@
 # define GET_DTV(descr) \
   (((tcbhead_t *) (descr))->dtv)
 
+/* Global scope switch support.  */
+#define THREAD_GSCOPE_IN_TCB      0
+#define THREAD_GSCOPE_GLOBAL
+#define THREAD_GSCOPE_SET_FLAG() \
+  atomic_exchange_and_add_acq (&GL(dl_thread_gscope_count), 1)
+#define THREAD_GSCOPE_RESET_FLAG() \
+  do 									      \
+    if (atomic_exchange_and_add_rel (&GL(dl_thread_gscope_count), -1) == 1)   \
+      lll_wake (&GL(dl_thread_gscope_count), 0);			      \
+  while (0)
+#define THREAD_GSCOPE_WAIT() \
+  do 									      \
+    {									      \
+      int count;							      \
+      atomic_write_barrier ();						      \
+      while ((count = GL(dl_thread_gscope_count)))			      \
+        lll_wait (&GL(dl_thread_gscope_count), count, 0);		      \
+    }									      \
+  while (0)
+
 #endif /* !ASSEMBLER */