Last change
on this file since 7406 was
7361,
checked in by rennerc, 19 years ago
|
added signalhandling class to orx
|
File size:
988 bytes
|
Line | |
---|
1 | /*! |
---|
2 | * @file signalhandler.h |
---|
3 | * Defines game rules for this game |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _SIGNAL_HANDLER_H |
---|
7 | #define _SIGNAL_HANDLER_H |
---|
8 | |
---|
9 | #include <list> |
---|
10 | #include <string> |
---|
11 | #include <signal.h> |
---|
12 | |
---|
13 | #define GDB_BT_FILE "orxonox.backtrace" |
---|
14 | |
---|
15 | struct SignalRec |
---|
16 | { |
---|
17 | int signal; |
---|
18 | sighandler_t handler; |
---|
19 | }; |
---|
20 | |
---|
21 | typedef std::list<SignalRec> SignalRecList; |
---|
22 | |
---|
23 | enum GdbRunType{ |
---|
24 | GDB_RUN_WRITE_TO_FILE = 1, |
---|
25 | GDB_RUN_IN_FOREGROUND |
---|
26 | }; |
---|
27 | |
---|
28 | class SignalHandler |
---|
29 | { |
---|
30 | private: |
---|
31 | SignalHandler(); |
---|
32 | public: |
---|
33 | inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); |
---|
34 | return SignalHandler::singletonRef; } |
---|
35 | |
---|
36 | void doCatch( std::string appName, GdbRunType type = GDB_RUN_WRITE_TO_FILE ); |
---|
37 | void dontCatch(); |
---|
38 | |
---|
39 | private: |
---|
40 | static void sigHandler( int sig ); |
---|
41 | |
---|
42 | void catchSignal( int sig ); |
---|
43 | SignalRecList sigRecList; |
---|
44 | |
---|
45 | static SignalHandler * singletonRef; |
---|
46 | |
---|
47 | GdbRunType type; |
---|
48 | |
---|
49 | std::string appName; |
---|
50 | }; |
---|
51 | |
---|
52 | |
---|
53 | #endif /* _SIGNAL_HANDLER_H */ |
---|
54 | |
---|
Note: See
TracBrowser
for help on using the repository browser.