- pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0);
- /* Loop on async-signal-safe cancellation point */
- for (;;) sleep(1);
+ for (;;) {
+ siginfo_t si;
+ while (sigwaitinfo(SIGTIMER_SET, &si) < 0);
+ if (si.si_code == SI_TIMER && !setjmp(jb)) {
+ pthread_cleanup_push(cleanup_fromsig, jb);
+ notify(val);
+ pthread_cleanup_pop(1);
+ }
+ if (self->timer_id < 0) break;
+ }
+ __syscall(SYS_timer_delete, id);