From 010812f2a791b2048a76adbf40771ae166e1a46c Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 22 Feb 2008 19:11:43 +0000 Subject: 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 --- src/threadengines/threadengine_win32.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/threadengines') 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) -- cgit v1.2.3