aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach/hurd')
-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 f686a39024..669c17151a 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)