1
0
mirror of https://github.com/anope/anope.git synced 2026-07-02 09:46:38 +02:00

Changed threadengine to delete threads after Joining them, so the whole thread exists when being joined and so its safe to call non-threadsafe functions in the destructor

This commit is contained in:
Adam
2010-05-09 17:50:53 -04:00
committed by Adam
parent 6db15e1783
commit 4149afd45d
3 changed files with 3 additions and 2 deletions
-1
View File
@@ -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
+2 -1
View File
@@ -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
+1
View File
@@ -6,6 +6,7 @@ void Thread::Join()
{
SetExitState();
WaitForSingleObject(Handle, INFINITE);
delete this;
}
/** Entry point for the thread