- if (setjmp(jb)) return;
- pthread_cleanup_push(cleanup_fromsig, jb);
- notify(val);
- pthread_cleanup_pop(0);
+ if (!setjmp(jb) && si->si_code == SI_TIMER) {
+ pthread_cleanup_push(cleanup_fromsig, jb);
+ notify(val);
+ pthread_cleanup_pop(0);
+ }
+}
+
+static void install_handler()
+{
+ struct sigaction sa = {
+ .sa_sigaction = timer_handler,
+ .sa_flags = SA_SIGINFO | SA_RESTART
+ };
+ __libc_sigaction(SIGTIMER, &sa, 0);
+ __syscall(SYS_rt_sigprocmask, SIG_UNBLOCK, SIGTIMER_SET, 0, 8);