From 35f88ac67c872077206f01d05589dc208ee5851f Mon Sep 17 00:00:00 2001 From: sapier Date: Fri, 6 Dec 2013 17:49:10 +0100 Subject: Fix win32 jthread implementation --- src/jthread/win32/jthread.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) mode change 100644 => 100755 src/jthread/win32/jthread.cpp (limited to 'src/jthread/win32/jthread.cpp') diff --git a/src/jthread/win32/jthread.cpp b/src/jthread/win32/jthread.cpp old mode 100644 new mode 100755 index 0781982e2..6a745c590 --- a/src/jthread/win32/jthread.cpp +++ b/src/jthread/win32/jthread.cpp @@ -46,14 +46,21 @@ JThread::~JThread() void JThread::Stop() { runningmutex.Lock(); - requeststop = false; + requeststop = true; runningmutex.Unlock(); } void JThread::Wait() { - int WaitForSingleObject_retval = WaitForSingleObject(threadhandle, INFINITE); - assert(WaitForSingleObject_retval == 0); - UNUSED(WaitForSingleObject_retval); + runningmutex.Lock(); + if (running) + { + runningmutex.Unlock(); + WaitForSingleObject(threadhandle, INFINITE); + } + else + { + runningmutex.Unlock(); + } } int JThread::Start() -- cgit v1.2.3