X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fthread%2Fpthread_setcancelstate.c;h=5ab8c338f7969c8d79d24fe1a9c18a7481e62555;hb=d055e6a45a17673b8dd3ec16e786bb2fe1700dd5;hp=ba2b231190436076b1d200bc76fa6e2c5dec9443;hpb=870cc679771f776333953b2a990a107393d9d0fd;p=musl diff --git a/src/thread/pthread_setcancelstate.c b/src/thread/pthread_setcancelstate.c index ba2b2311..5ab8c338 100644 --- a/src/thread/pthread_setcancelstate.c +++ b/src/thread/pthread_setcancelstate.c @@ -1,15 +1,12 @@ #include "pthread_impl.h" -int pthread_setcancelstate(int new, int *old) +int __pthread_setcancelstate(int new, int *old) { - if (new > 1U) return EINVAL; - if (libc.main_thread) { - struct pthread *self = __pthread_self(); - if (old) *old = self->canceldisable; - self->canceldisable = new; - } else { - if (old) *old = libc.canceldisable; - libc.canceldisable = new; - } + if (new > 2U) return EINVAL; + struct pthread *self = __pthread_self(); + if (old) *old = self->canceldisable; + self->canceldisable = new; return 0; } + +weak_alias(__pthread_setcancelstate, pthread_setcancelstate);