1 /* $NetBSD: sleep1.c,v 1.2 2005/08/29 18:52:16 drochner Exp $ */
10 void *threadfunc(void *);
13 #define LONGTIME 2000000000
23 printf("Testing sleeps unreasonably far into the future.\n");
25 act
.sa_handler
= handler
;
26 sigemptyset(&act
.sa_mask
);
28 sigaction(SIGALRM
, &act
, NULL
);
30 pthread_create(&thread
, NULL
, threadfunc
, NULL
);
32 /* make sure the signal is delivered to the child thread */
34 sigaddset(&mtsm
, SIGALRM
);
35 pthread_sigmask(SIG_BLOCK
, &mtsm
, 0);
37 timerclear(&it
.it_interval
);
38 timerclear(&it
.it_value
);
39 it
.it_value
.tv_sec
= 1;
40 setitimer(ITIMER_REAL
, &it
, NULL
);
42 pthread_join(thread
, NULL
);
60 * Nothing to do; invoking the handler is enough to interrupt