summaryrefslogtreecommitdiff
path: root/reference/C/CONTRIB/OR_USING_C/08.6.c
blob: 80ccd1e225208b88702b4ecdddce7aee4bf0a965 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <signal.h>

/*
 * work, work, work, all I ever do is work!
 */
dowork()
{
}

main()
{
    int mask;

    /*
     * Block SIGIO, which will indicate more
     * work to be done.
     */
    mask = sigmask(SIGIO);

    for (;;) {
        /*
         * Go do work.
         */
        dowork();

        /*
         * Pause until we receive a signal.
         * SIGIO is not blocked in mask.
         */
        sigpause(mask);
    }
}