diff options
author | Christian Pointner <equinox@anytun.org> | 2008-10-19 23:53:47 +0000 |
---|---|---|
committer | Christian Pointner <equinox@anytun.org> | 2008-10-19 23:53:47 +0000 |
commit | 3f44dbd1d2924f001c45793e706a6217aa8aa471 (patch) | |
tree | 920d72f3218e2c3b4bffaec501f5fc9b12c6c2a7 /src/signalController.cpp | |
parent | fixed makefile (diff) |
the signal controller uses boost thread now,
however this code can only work as long boost thread uses pthread
removed temporarly brocken anyrtpproxy from all target at make
use make anyrtpproxy to build it
replaced the pthread callbacks for libgcrypt with boost thread callbacks
Diffstat (limited to 'src/signalController.cpp')
-rw-r--r-- | src/signalController.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/signalController.cpp b/src/signalController.cpp index ebd6897..cef743f 100644 --- a/src/signalController.cpp +++ b/src/signalController.cpp @@ -34,7 +34,8 @@ #include <iostream> -//#include "threadUtils.hpp" +#include <boost/bind.hpp> +#include "threadUtils.hpp" #include "signalController.h" #include "log.h" @@ -85,9 +86,10 @@ SignalController::~SignalController() { for(HandlerMap::iterator it = handler.begin(); it != handler.end(); ++it) delete it->second; + if(thread) delete thread; } -void* SignalController::handle(void *s) +void SignalController::handle(void *s) { SignalController* self = reinterpret_cast<SignalController*>(s); sigset_t signal_set; @@ -103,7 +105,6 @@ void* SignalController::handle(void *s) } self->sigQueueSem.up(); } - pthread_exit(NULL); } void SignalController::init() @@ -115,10 +116,9 @@ void SignalController::init() sigdelset(&signal_set, SIGSEGV); sigdelset(&signal_set, SIGBUS); sigdelset(&signal_set, SIGFPE); - pthread_sigmask(SIG_BLOCK, &signal_set, NULL); + pthread_sigmask(SIG_BLOCK, &signal_set, NULL); // TODO: remove ugly workaround - pthread_create(&thread, NULL, handle, this); - pthread_detach(thread); + thread = new boost::thread(boost::bind(handle, this)); handler[SIGINT] = new SigIntHandler; handler[SIGQUIT] = new SigQuitHandler; |