blob: f057bdfee5b08dbc280befb58061684b335b054a (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*
*/
#ifndef SIGNAL_H
#define SIGNAL_H
#include <signal.h>
#include "sockets.h"
/** Represents a signal handler
*/
class Signal : public Pipe
{
static std::vector<Signal *> SignalHandlers;
static void SignalHandler(int signal);
struct sigaction action, old;
public:
int signal;
/** Constructor
* @param s The signal to listen for
*/
Signal(int s);
~Signal();
/**
* Called when the signal is received.
* Note this is not *immediatly* called when the signal is received,
* but it is saved and called at a later time when we are not doing something
* important. This is always called on the main thread, even on systems that
* spawn threads for signals, like Windows.
*/
virtual void OnNotify() anope_override = 0;
};
#endif
|