summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/threadengine.cpp1
-rw-r--r--src/threadengine_pthread.cpp3
-rw-r--r--src/threadengine_win32.cpp1
3 files changed, 3 insertions, 2 deletions
diff --git a/src/threadengine.cpp b/src/threadengine.cpp
index f7e924fb6..ea652e1f2 100644
--- a/src/threadengine.cpp
+++ b/src/threadengine.cpp
@@ -12,7 +12,6 @@ Thread::Thread() : Exit(false)
*/
Thread::~Thread()
{
- Join();
}
/** Sets the exit state as true informing the thread we want it to shut down
diff --git a/src/threadengine_pthread.cpp b/src/threadengine_pthread.cpp
index 58b3a11ac..199bd0860 100644
--- a/src/threadengine_pthread.cpp
+++ b/src/threadengine_pthread.cpp
@@ -6,6 +6,7 @@ void Thread::Join()
{
SetExitState();
pthread_join(Handle, NULL);
+ delete this;
}
/* Threadengine attributes used by this thread engine */
@@ -18,7 +19,7 @@ static void *entry_point(void *parameter)
{
Thread *thread = static_cast<Thread *>(parameter);
thread->Run();
- return parameter;
+ pthread_exit(0);
}
/** Threadengines constructor
diff --git a/src/threadengine_win32.cpp b/src/threadengine_win32.cpp
index 602d8b809..d3c0303f5 100644
--- a/src/threadengine_win32.cpp
+++ b/src/threadengine_win32.cpp
@@ -6,6 +6,7 @@ void Thread::Join()
{
SetExitState();
WaitForSingleObject(Handle, INFINITE);
+ delete this;
}
/** Entry point for the thread