summaryrefslogtreecommitdiff
path: root/src/threadengines/threadengine_pthread.cpp
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-08-30 13:01:10 +0200
committerattilamolnar <attilamolnar@hush.com>2013-08-30 13:01:10 +0200
commit1031f333332cf1b09db4fd632f141143ee637c34 (patch)
tree3f2b3c08e9a743f19725da45f3879aa2bf54bfbf /src/threadengines/threadengine_pthread.cpp
parent7432fea968127b606fc029ae462e91d3f30df8a4 (diff)
parentd54eec6dd8d44cba3c1e935f72089dbe675e0820 (diff)
Merge insp20
Diffstat (limited to 'src/threadengines/threadengine_pthread.cpp')
-rw-r--r--src/threadengines/threadengine_pthread.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/threadengines/threadengine_pthread.cpp b/src/threadengines/threadengine_pthread.cpp
index c1b964430..e16e401f3 100644
--- a/src/threadengines/threadengine_pthread.cpp
+++ b/src/threadengines/threadengine_pthread.cpp
@@ -80,6 +80,8 @@ class ThreadSignalSocket : public EventHandler
~ThreadSignalSocket()
{
+ ServerInstance->SE->DelFd(this);
+ ServerInstance->SE->Close(GetFd());
}
void Notify()
@@ -104,6 +106,7 @@ class ThreadSignalSocket : public EventHandler
SocketThread::SocketThread()
{
+ signal.sock = NULL;
int fd = eventfd(0, EFD_NONBLOCK);
if (fd < 0)
throw new CoreException("Could not create pipe " + std::string(strerror(errno)));
@@ -127,6 +130,8 @@ class ThreadSignalSocket : public EventHandler
~ThreadSignalSocket()
{
close(send_fd);
+ ServerInstance->SE->DelFd(this);
+ ServerInstance->SE->Close(GetFd());
}
void Notify()
@@ -152,6 +157,7 @@ class ThreadSignalSocket : public EventHandler
SocketThread::SocketThread()
{
+ signal.sock = NULL;
int fds[2];
if (pipe(fds))
throw new CoreException("Could not create pipe " + std::string(strerror(errno)));
@@ -166,4 +172,9 @@ void SocketThread::NotifyParent()
SocketThread::~SocketThread()
{
+ if (signal.sock)
+ {
+ signal.sock->cull();
+ delete signal.sock;
+ }
}