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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -6,6 +6,7 @@ void Thread::Join()
|
||||
{
|
||||
SetExitState();
|
||||
WaitForSingleObject(Handle, INFINITE);
|
||||
delete this;
|
||||
}
|
||||
|
||||
/** Entry point for the thread
|
||||
|
||||
Reference in New Issue
Block a user