summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-02-22 19:11:43 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-02-22 19:11:43 +0000
commit010812f2a791b2048a76adbf40771ae166e1a46c (patch)
treeb50ddd4b7cebe413c0c2047dc6df263f633d1bd1
parent372dd12a80b17c811e183497be73bf7bb62664dc (diff)
Add the same thread safety checks to this, now ive got the project as a whole compiling.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9009 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/threadengines/threadengine_win32.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/threadengines/threadengine_win32.cpp b/src/threadengines/threadengine_win32.cpp
index 1b8d113ec..07d1b2373 100644
--- a/src/threadengines/threadengine_win32.cpp
+++ b/src/threadengines/threadengine_win32.cpp
@@ -33,10 +33,14 @@ void Win32ThreadEngine::Create(Thread* thread_to_init)
Mutex(false);
throw CoreException(std::string("Unable to reate new Win32ThreadEngine: ") + dlerror());
}
+
NewThread = thread_to_init;
NewThread->Creator = this;
NewThread->Extend("winthread", MyThread);
Mutex(false);
+
+ while (NewThread)
+ SleepEx(100, false);
}
Win32ThreadEngine::~Win32ThreadEngine()
@@ -46,7 +50,11 @@ Win32ThreadEngine::~Win32ThreadEngine()
void Win32ThreadEngine::Run()
{
- NewThread->Run();
+ Mutex(true);
+ Thread* nt = NewThread;
+ NewThread = NULL;
+ Mutex(false);
+ nt->Run();
}
bool Win32ThreadEngine::Mutex(bool enable)