aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-x[-rw-r--r--]src/jthread/win32/jsemaphore.cpp2
-rwxr-xr-x[-rw-r--r--]src/jthread/win32/jthread.cpp15
2 files changed, 12 insertions, 5 deletions
diff --git a/src/jthread/win32/jsemaphore.cpp b/src/jthread/win32/jsemaphore.cpp
index 8eca6d247..3a1f2715c 100644..100755
--- a/src/jthread/win32/jsemaphore.cpp
+++ b/src/jthread/win32/jsemaphore.cpp
@@ -27,7 +27,7 @@ JSemaphore::JSemaphore() {
}
JSemaphore::~JSemaphore() {
- CloseHandle(&m_hSemaphore);
+ CloseHandle(m_hSemaphore);
}
JSemaphore::JSemaphore(int initval) {
diff --git a/src/jthread/win32/jthread.cpp b/src/jthread/win32/jthread.cpp
index 0781982e2..6a745c590 100644..100755
--- 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()