- struct sigaction sa = { .sa_flags = SA_SIGINFO | SA_RESTART };
- libc.lock = __lock;
- libc.lockfile = __lockfile;
- libc.cancelpt = cancelpt;
-
- sigemptyset(&sa.sa_mask);
- sa.sa_sigaction = cancel_handler;
- __libc_sigaction(SIGCANCEL, &sa, 0);
-
- sigaddset(&sa.sa_mask, SIGSYSCALL);
- sigaddset(&sa.sa_mask, SIGCANCEL);
- __libc_sigprocmask(SIG_UNBLOCK, &sa.sa_mask, 0);
-}
-
-static int start(void *p)
-{
- struct pthread *self = p;
- if (self->unblock_cancel) {
- sigset_t set;
- sigemptyset(&set);
- sigaddset(&set, SIGCANCEL);
- __libc_sigprocmask(SIG_UNBLOCK, &set, 0);
- }
+ if (self->unblock_cancel)
+ __syscall(SYS_rt_sigprocmask, SIG_UNBLOCK, SIGPT_SET, 0, 8);