diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-02-09 22:23:52 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-02-10 01:03:50 +0000 |
commit | 59b7fe99f2593682ba779fe0faa8f1156d48d087 (patch) | |
tree | 6593a95d3d233a943b67a290cccf78fbbc793c0c /sysdeps | |
parent | htl: clean __pthread_get_cleanup_stack hidden proto (diff) | |
download | glibc-59b7fe99f2593682ba779fe0faa8f1156d48d087.tar.gz glibc-59b7fe99f2593682ba779fe0faa8f1156d48d087.tar.bz2 glibc-59b7fe99f2593682ba779fe0faa8f1156d48d087.zip |
htl: Add support for libc cancellation points
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/htl/pthreadP.h | 1 | ||||
-rw-r--r-- | sysdeps/mach/hurd/sysdep-cancel.h | 20 |
2 files changed, 19 insertions, 2 deletions
diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h index 7de96120a4..2bb4baa249 100644 --- a/sysdeps/htl/pthreadP.h +++ b/sysdeps/htl/pthreadP.h @@ -84,6 +84,7 @@ int __pthread_attr_setstacksize (pthread_attr_t *__attr, size_t __stacksize); int __pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr, size_t __stacksize); int __pthread_attr_getstack (const pthread_attr_t *, void **, size_t *); +void __pthread_testcancel (void); #if IS_IN (libpthread) hidden_proto (__pthread_key_create) 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) |