summaryrefslogtreecommitdiff
path: root/src/threadengines/threadengine_pthread.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-10-01 21:01:49 -0400
committerAdam <Adam@anope.org>2010-10-01 21:01:49 -0400
commitd44f7971b129aa7ba80999f16f17b8c7499686e1 (patch)
treea86d08c3e641ed6b499b53b3bbb74e2a7f5b0dfb /src/threadengines/threadengine_pthread.cpp
parent70056dd4689eeab4f7a9b31a921e0d7e40d5ed0d (diff)
Rewrote some of the socket code to allow m_ssl to be a service.
This allows modules (xmlrpc) to create and accept SSL connections. Also fixed unloading m_mysql at certain times and made the threading engine always work correctly on Windows.
Diffstat (limited to 'src/threadengines/threadengine_pthread.cpp')
-rw-r--r--src/threadengines/threadengine_pthread.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/threadengines/threadengine_pthread.cpp b/src/threadengines/threadengine_pthread.cpp
index fb0b29506..65d1533f3 100644
--- a/src/threadengines/threadengine_pthread.cpp
+++ b/src/threadengines/threadengine_pthread.cpp
@@ -10,9 +10,7 @@ static void *entry_point(void *parameter)
{
Thread *thread = static_cast<Thread *>(parameter);
thread->Run();
- if (!thread->GetExitState())
- thread->Join();
- delete thread;
+ thread->SetExitState();
pthread_exit(0);
}
@@ -22,6 +20,8 @@ ThreadEngine::ThreadEngine()
{
if (pthread_attr_init(&threadengine_attr))
throw CoreException("ThreadEngine: Error calling pthread_attr_init");
+ if (pthread_attr_setdetachstate(&threadengine_attr, PTHREAD_CREATE_JOINABLE))
+ throw CoreException("ThreadEngine: Unable to mark threads as joinable");
}
/** Threadengines destructor
@@ -35,7 +35,7 @@ ThreadEngine::~ThreadEngine()
*/
void Thread::Join()
{
- SetExitState();
+ this->SetExitState();
pthread_join(Handle, NULL);
}