diff options
author | sapier <Sapier at GMX dot net> | 2013-12-06 17:49:10 +0100 |
---|---|---|
committer | sapier <Sapier at GMX dot net> | 2013-12-06 17:49:10 +0100 |
commit | 35f88ac67c872077206f01d05589dc208ee5851f (patch) | |
tree | 98b83c358d86b3fab1eac70092ba85e8004955ff /src/jthread/win32 | |
parent | 22dbbf0a6fc9547f0dbdb7f6076337b8c6acd48b (diff) | |
download | minetest-35f88ac67c872077206f01d05589dc208ee5851f.tar.gz minetest-35f88ac67c872077206f01d05589dc208ee5851f.tar.bz2 minetest-35f88ac67c872077206f01d05589dc208ee5851f.zip |
Fix win32 jthread implementation
Diffstat (limited to 'src/jthread/win32')
-rwxr-xr-x[-rw-r--r--] | src/jthread/win32/jsemaphore.cpp | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | src/jthread/win32/jthread.cpp | 15 |
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() |