File: handleprocesssignals.cc

package info (click to toggle)
stealth 1.47.4-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 780 kB
  • ctags: 190
  • sloc: cpp: 1,710; makefile: 155; sh: 62
file content (35 lines) | stat: -rw-r--r-- 971 bytes parent folder | download | duplicates (3)
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
34
35
#include "monitor.ih"

// activated by 
void Monitor::handleProcessSignals(int signum)
{
    switch (signum)
    {
        case SIGTERM:                       // TERMINATE
            if (s_mode != TERMINATED)
            {
                s_quit = true;
                s_mode = TERMINATE;
            }
        break;

        case SIGHUP:                        // RERUN
            if (s_mode != KEEP_ALIVE)       // wakeup if mode is KEEP_ALIVE
                return;
        break;

        case SIGUSR1:                       // SUPPRESS
            if (s_mode == KEEP_ALIVE)
                s_mode = SUPPRESS;          // changed to SUPPRESSED in
                                            // processMode() 
        break;

        case SIGUSR2:                       // RESUME
            if (s_mode == SUPPRESS || s_mode == SUPPRESSED)
                s_mode = KEEP_ALIVE;
        break;
    }

    Util::wakeup();
    signal(signum, handleProcessSignals);
}