11 handler(int sig, siginfo_t *si, void *ctx)
13 if (si->si_code != SI_QUEUE)
14 errx(1, "si_code != SI_QUEUE");
15 if (si->si_value.sival_int != received)
16 errx(1, "signal is out of order");
29 sa.sa_flags = SA_SIGINFO;
30 sigemptyset(&sa.sa_mask);
31 sa.sa_sigaction = handler;
32 sigaction(SIGRTMIN, &sa, NULL);
34 sigaddset(&set, SIGRTMIN);
35 sigprocmask(SIG_BLOCK, &set, NULL);
39 ret = sigqueue(getpid(), SIGRTMIN, val);
41 if (errno != EAGAIN) {
42 errx(1, "errno != EAGAIN");
48 sigprocmask(SIG_UNBLOCK, &set, NULL);
50 errx(1, "error, signal lost");