19121620dSAxel Dörfler#include <signal.h>
29121620dSAxel Dörfler#include <unistd.h>
39121620dSAxel Dörfler#include <stdio.h>
49121620dSAxel Dörfler#include <time.h>
59121620dSAxel Dörfler
69121620dSAxel Dörfler
79121620dSAxel Dörflervoid
89121620dSAxel Dörflerhandler(int signal)
99121620dSAxel Dörfler{
109121620dSAxel Dörfler    printf( "inside handler()\n" );
119121620dSAxel Dörfler}
129121620dSAxel Dörfler
139121620dSAxel Dörfler
149121620dSAxel Dörflerint
159121620dSAxel Dörflermain(int argc, char* argv[])
169121620dSAxel Dörfler{
179121620dSAxel Dörfler	struct sigaction signalAction;
189121620dSAxel Dörfler	sigset_t blockedSignalSet;
199121620dSAxel Dörfler
209121620dSAxel Dörfler	sigfillset(&blockedSignalSet);
219121620dSAxel Dörfler	sigdelset(&blockedSignalSet, SIGALRM);
229121620dSAxel Dörfler
239121620dSAxel Dörfler	sigemptyset(&signalAction.sa_mask);
249121620dSAxel Dörfler	signalAction.sa_flags = 0;
259121620dSAxel Dörfler	signalAction.sa_handler = handler;
269121620dSAxel Dörfler	sigaction(SIGALRM, &signalAction, NULL);
279121620dSAxel Dörfler
289121620dSAxel Dörfler    fprintf(stdout, "before sigsuspend()\n");
299121620dSAxel Dörfler    alarm(2);
309121620dSAxel Dörfler    sigsuspend(&blockedSignalSet);
319121620dSAxel Dörfler    fprintf(stdout, "after sigsuspend()\n");
329121620dSAxel Dörfler
339121620dSAxel Dörfler    return 0;
349121620dSAxel Dörfler}
35