summaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd/tls.h
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-27 19:01:57 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-27 19:01:57 +0000
commitcab56836b146bc129f1ad43f0393d95a9deca63a (patch)
tree4f4e655319bbac78fca170da05275c127429b460 /sysdeps/mach/hurd/tls.h
parent04ac1241a4cd004872282c2c82ec37fa33925292 (diff)
parent82dd75a7f436a19047325d62182590c9f9e23a78 (diff)
Merge branch 't/tls' into refs/top-bases/t/tls-threadvar
Diffstat (limited to 'sysdeps/mach/hurd/tls.h')
-rw-r--r--sysdeps/mach/hurd/tls.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/sysdeps/mach/hurd/tls.h b/sysdeps/mach/hurd/tls.h
index 67ed17d00d..67c657b655 100644
--- a/sysdeps/mach/hurd/tls.h
+++ b/sysdeps/mach/hurd/tls.h
@@ -1,5 +1,5 @@
/* Definitions for thread-local data handling. Hurd version.
- Copyright (C) 2003-2016 Free Software Foundation, Inc.
+ Copyright (C) 2003-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -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 */