rework langinfo code for ABI compat and for use by time code
[musl] / src / thread / pthread_setcancelstate.c
1 #include "pthread_impl.h"
2
3 int pthread_setcancelstate(int new, int *old)
4 {
5         if (new > 1U) return EINVAL;
6         if (libc.main_thread) {
7                 struct pthread *self = __pthread_self();
8                 if (old) *old = self->canceldisable;
9                 self->canceldisable = new;
10         } else {
11                 if (old) *old = libc.canceldisable;
12                 libc.canceldisable = new;
13         }
14         return 0;
15 }