aboutsummaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2004-05-02 21:27:15 (GMT)
committerfluxgen <fluxgen>2004-05-02 21:27:15 (GMT)
commitec7d792a484e6882118caa34521ffb8b23fa871b (patch)
treec1fef3b9c1cab645578f18951f7a5729174c6b94 /src/tests
parent4880851f132fc3874c5bb01db2f68bc66320063c (diff)
downloadfluxbox-ec7d792a484e6882118caa34521ffb8b23fa871b.zip
fluxbox-ec7d792a484e6882118caa34521ffb8b23fa871b.tar.bz2
minor fixes
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/signaltest.cc22
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 @@
27using namespace std; 27using namespace std;
28using namespace FbTk; 28using namespace FbTk;
29 29
30class IntSig:public SignalHandler::EventHandler { 30class IntSig:public SignalEventHandler {
31public: 31public:
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
39class AllSig:public SignalHandler::EventHandler { 39class AllSig:public SignalEventHandler {
40public: 40public:
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
61int main(int argc, char **argv) { 64int 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