diff options
author | Adam <Adam@anope.org> | 2012-02-14 15:13:27 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-02-14 15:13:27 -0500 |
commit | a9772cde21407c89abd161d51aff45267f87b1fb (patch) | |
tree | 9e57ba6c121d3843888917d968dd4f5d030b57cf /include/signals.h | |
parent | 086790d6331357022f4da17c76b26b9fc6e2ad90 (diff) |
Clean up and reorganize our header files
Diffstat (limited to 'include/signals.h')
-rw-r--r-- | include/signals.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/include/signals.h b/include/signals.h new file mode 100644 index 000000000..70fdead42 --- /dev/null +++ b/include/signals.h @@ -0,0 +1,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() = 0; +}; + +#endif + |