summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/SignalHandler.hh21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/SignalHandler.hh b/src/SignalHandler.hh
index efbf73f..93d5ae4 100644
--- a/src/SignalHandler.hh
+++ b/src/SignalHandler.hh
@@ -19,15 +19,21 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: SignalHandler.hh,v 1.2 2002/08/14 22:49:32 fluxgen Exp $ 22// $Id: SignalHandler.hh,v 1.3 2002/08/17 22:15:04 fluxgen Exp $
23 23
24#ifndef FBTK_SIGNALHANDLER_HH 24#ifndef FBTK_SIGNALHANDLER_HH
25#define FBTK_SIGNALHANDLER_HH 25#define FBTK_SIGNALHANDLER_HH
26 26
27#include "EventHandler.hh"
28
27#include <signal.h> 29#include <signal.h>
28 30
29namespace FbTk { 31namespace FbTk {
30 32
33struct SignalEvent {
34 int signum;
35};
36
31/** 37/**
32 Handles system signals, singleton. 38 Handles system signals, singleton.
33 Usage: inherit the class EventHandler and then register 39 Usage: inherit the class EventHandler and then register
@@ -36,14 +42,7 @@ namespace FbTk {
36*/ 42*/
37class SignalHandler { 43class SignalHandler {
38public: 44public:
39 /** 45
40 Inherit this class to handle signals.
41 */
42 class EventHandler {
43 public:
44 virtual void handleSignal(int signum) = 0;
45 };
46
47 /// get singleton object 46 /// get singleton object
48 static SignalHandler *instance(); 47 static SignalHandler *instance();
49 /** 48 /**
@@ -53,7 +52,7 @@ public:
53 @param eh event handler 52 @param eh event handler
54 @param oldhandler_ret return handler to old sighandler 53 @param oldhandler_ret return handler to old sighandler
55 */ 54 */
56 bool registerHandler(int signum, EventHandler *eh, EventHandler **oldhandler_ret = 0); 55 bool registerHandler(int signum, EventHandler<SignalEvent> *eh, EventHandler<SignalEvent> **oldhandler_ret = 0);
57 /** 56 /**
58 removes the signum handler 57 removes the signum handler
59 @param signum signal number 58 @param signum signal number
@@ -64,7 +63,7 @@ private:
64 63
65 static void handleSignal(int signum); 64 static void handleSignal(int signum);
66 65
67 static EventHandler *s_signal_handler[NSIG]; ///< NSIG defined in signal.h 66 static EventHandler<SignalEvent> *s_signal_handler[NSIG]; ///< NSIG defined in signal.h
68}; 67};
69 68
70}; // end namespace FbTk 69}; // end namespace FbTk