From ec7d792a484e6882118caa34521ffb8b23fa871b Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sun, 2 May 2004 21:27:15 +0000 Subject: minor fixes --- src/tests/signaltest.cc | 22 ++++++++++++++-------- 1 file 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -#include "../SignalHandler.hh" +#include "../FbTk/SignalHandler.hh" #include #include @@ -27,7 +27,7 @@ using namespace std; using namespace FbTk; -class IntSig:public SignalHandler::EventHandler { +class IntSig:public SignalEventHandler { public: void handleSignal(int signum) { assert(signum == SIGINT); @@ -36,10 +36,13 @@ public: } }; -class AllSig:public SignalHandler::EventHandler { +class AllSig:public SignalEventHandler { public: void handleSignal(int signum) { switch (signum) { + case SIGSEGV: + cerr<<"SIGSEGV"; + break; case SIGTERM: cerr<<"SIGTERM"; break; @@ -59,14 +62,17 @@ public: }; int main(int argc, char **argv) { - SignalHandler *sigh = SignalHandler::instance(); + SignalHandler &sigh = SignalHandler::instance(); + IntSig handler; AllSig allhand; - sigh->registerHandler(SIGINT, &handler); - sigh->registerHandler(SIGTERM, &allhand); - sigh->registerHandler(SIGUSR1, &allhand); - sigh->registerHandler(SIGUSR2, &allhand); + sigh.registerHandler(SIGINT, &handler); + sigh.registerHandler(SIGSEGV, &allhand); + sigh.registerHandler(SIGTERM, &allhand); + sigh.registerHandler(SIGUSR1, &allhand); + sigh.registerHandler(SIGUSR2, &allhand); + cerr<<"Send signals to me :)"<