diff options
Diffstat (limited to 'src/tests/signaltest.cc')
-rw-r--r-- | src/tests/signaltest.cc | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/tests/signaltest.cc b/src/tests/signaltest.cc index 8ac7d90..ef7643f 100644 --- a/src/tests/signaltest.cc +++ b/src/tests/signaltest.cc | |||
@@ -19,7 +19,7 @@ | |||
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 | #include "../SignalHandler.hh" | 22 | #include "../FbTk/SignalHandler.hh" |
23 | 23 | ||
24 | #include <iostream> | 24 | #include <iostream> |
25 | #include <cassert> | 25 | #include <cassert> |
@@ -27,7 +27,7 @@ | |||
27 | using namespace std; | 27 | using namespace std; |
28 | using namespace FbTk; | 28 | using namespace FbTk; |
29 | 29 | ||
30 | class IntSig:public SignalHandler::EventHandler { | 30 | class IntSig:public SignalEventHandler { |
31 | public: | 31 | public: |
32 | void handleSignal(int signum) { | 32 | void handleSignal(int signum) { |
33 | assert(signum == SIGINT); | 33 | assert(signum == SIGINT); |
@@ -36,10 +36,13 @@ public: | |||
36 | } | 36 | } |
37 | }; | 37 | }; |
38 | 38 | ||
39 | class AllSig:public SignalHandler::EventHandler { | 39 | class AllSig:public SignalEventHandler { |
40 | public: | 40 | public: |
41 | void handleSignal(int signum) { | 41 | void handleSignal(int signum) { |
42 | switch (signum) { | 42 | switch (signum) { |
43 | case SIGSEGV: | ||
44 | cerr<<"SIGSEGV"; | ||
45 | break; | ||
43 | case SIGTERM: | 46 | case SIGTERM: |
44 | cerr<<"SIGTERM"; | 47 | cerr<<"SIGTERM"; |
45 | break; | 48 | break; |
@@ -59,14 +62,17 @@ public: | |||
59 | }; | 62 | }; |
60 | 63 | ||
61 | int main(int argc, char **argv) { | 64 | int main(int argc, char **argv) { |
62 | SignalHandler *sigh = SignalHandler::instance(); | 65 | SignalHandler &sigh = SignalHandler::instance(); |
66 | |||
63 | IntSig handler; | 67 | IntSig handler; |
64 | AllSig allhand; | 68 | AllSig allhand; |
65 | 69 | ||
66 | sigh->registerHandler(SIGINT, &handler); | 70 | sigh.registerHandler(SIGINT, &handler); |
67 | sigh->registerHandler(SIGTERM, &allhand); | 71 | sigh.registerHandler(SIGSEGV, &allhand); |
68 | sigh->registerHandler(SIGUSR1, &allhand); | 72 | sigh.registerHandler(SIGTERM, &allhand); |
69 | sigh->registerHandler(SIGUSR2, &allhand); | 73 | sigh.registerHandler(SIGUSR1, &allhand); |
74 | sigh.registerHandler(SIGUSR2, &allhand); | ||
75 | |||
70 | cerr<<"Send signals to me :)"<<endl; | 76 | cerr<<"Send signals to me :)"<<endl; |
71 | while (1) { | 77 | while (1) { |
72 | 78 | ||