mirror of
https://github.com/moparisthebest/minetest
synced 2024-11-05 00:45:05 -05:00
Fix win32 jthread implementation
This commit is contained in:
parent
22dbbf0a6f
commit
35f88ac67c
2
src/jthread/win32/jsemaphore.cpp
Normal file → Executable file
2
src/jthread/win32/jsemaphore.cpp
Normal file → Executable file
@ -27,7 +27,7 @@ JSemaphore::JSemaphore() {
|
||||
}
|
||||
|
||||
JSemaphore::~JSemaphore() {
|
||||
CloseHandle(&m_hSemaphore);
|
||||
CloseHandle(m_hSemaphore);
|
||||
}
|
||||
|
||||
JSemaphore::JSemaphore(int initval) {
|
||||
|
15
src/jthread/win32/jthread.cpp
Normal file → Executable file
15
src/jthread/win32/jthread.cpp
Normal file → Executable file
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user