Expand PMF_FN_* macros.
[netbsd-mini2440.git] / regress / lib / libpthread / sigsuspend / sigsuspend.c
blob600ef25035c71800c401fac0814687970e1c348a
1 /* $NetBSD: sigsuspend.c,v 1.1 2003/03/01 01:46:03 lha Exp $ */
3 /*
4 * Regression test for sigsuspend in libpthread when pthread lib isn't
5 * initialized.
7 * Written by Love Hörnquist Åstrand <lha@NetBSD.org>, March 2003.
8 * Public domain.
9 */
11 #include <assert.h>
12 #include <err.h>
13 #include <stdio.h>
14 #include <signal.h>
15 #include <unistd.h>
17 static void alarm_handler(int);
19 int alarm_set;
21 static void
22 alarm_handler(int signo)
24 alarm_set = 1;
27 int
28 main(int argc, char **argv)
30 struct sigaction sa;
31 sigset_t set;
33 sa.sa_flags = 0;
34 sa.sa_handler = alarm_handler;
35 sigemptyset(&sa.sa_mask);
37 sigaction(SIGALRM, &sa, NULL);
39 alarm(1);
41 sigemptyset(&set);
42 sigaddset(&set, SIGUSR1);
44 sigsuspend(&set);
46 alarm(0);
48 if (!alarm_set)
49 errx(1, "alarm_set not set");
51 return 0;