summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/src/thread/pthread_setcanceltype.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc-top-half/musl/src/thread/pthread_setcanceltype.c')
-rw-r--r--libc-top-half/musl/src/thread/pthread_setcanceltype.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/thread/pthread_setcanceltype.c b/libc-top-half/musl/src/thread/pthread_setcanceltype.c
new file mode 100644
index 0000000..bf0a3f3
--- /dev/null
+++ b/libc-top-half/musl/src/thread/pthread_setcanceltype.c
@@ -0,0 +1,11 @@
+#include "pthread_impl.h"
+
+int pthread_setcanceltype(int new, int *old)
+{
+ struct pthread *self = __pthread_self();
+ if (new > 1U) return EINVAL;
+ if (old) *old = self->cancelasync;
+ self->cancelasync = new;
+ if (new) pthread_testcancel();
+ return 0;
+}