aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/mach
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-02-09 22:23:52 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-02-10 01:03:50 +0000
commit59b7fe99f2593682ba779fe0faa8f1156d48d087 (patch)
tree6593a95d3d233a943b67a290cccf78fbbc793c0c /sysdeps/mach
parentf1cd3407e4c6767e0bbe2ca122b713c6581b8d67 (diff)
downloadglibc-59b7fe99f2593682ba779fe0faa8f1156d48d087.zip
glibc-59b7fe99f2593682ba779fe0faa8f1156d48d087.tar.gz
glibc-59b7fe99f2593682ba779fe0faa8f1156d48d087.tar.bz2
htl: Add support for libc cancellation points
Diffstat (limited to 'sysdeps/mach')
-rw-r--r--sysdeps/mach/hurd/sysdep-cancel.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/sysdeps/mach/hurd/sysdep-cancel.h b/sysdeps/mach/hurd/sysdep-cancel.h
index f686a39..669c171 100644
--- a/sysdeps/mach/hurd/sysdep-cancel.h
+++ b/sysdeps/mach/hurd/sysdep-cancel.h
@@ -1,8 +1,24 @@
#include <sysdep.h>
+int __pthread_enable_asynccancel (void);
+void __pthread_disable_asynccancel (int oldtype);
+
+#pragma weak __pthread_enable_asynccancel
+#pragma weak __pthread_disable_asynccancel
+
/* Always multi-thread (since there's at least the sig handler), but no
handling enabled. */
#define SINGLE_THREAD_P (0)
#define RTLD_SINGLE_THREAD_P (0)
-#define LIBC_CANCEL_ASYNC() 0 /* Just a dummy value. */
-#define LIBC_CANCEL_RESET(val) ((void)(val)) /* Nothing, but evaluate it. */
+
+#define LIBC_CANCEL_ASYNC() ({ \
+ int __cancel_oldtype = 0; \
+ if (__pthread_enable_asynccancel) \
+ __cancel_oldtype = __pthread_enable_asynccancel(); \
+ __cancel_oldtype; \
+})
+
+#define LIBC_CANCEL_RESET(val) do { \
+ if (__pthread_disable_asynccancel) \
+ __pthread_disable_asynccancel (val); \
+} while (0)