diff options
Diffstat (limited to 'src/thread/thread_win32.cpp')
-rw-r--r-- | src/thread/thread_win32.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/thread/thread_win32.cpp b/src/thread/thread_win32.cpp index e752de1ae..a3b2d3734 100644 --- a/src/thread/thread_win32.cpp +++ b/src/thread/thread_win32.cpp @@ -107,16 +107,19 @@ private: class ThreadMutex_Win32 : public ThreadMutex { private: CRITICAL_SECTION critical_section; + HANDLE event; public: ThreadMutex_Win32() { InitializeCriticalSection(&this->critical_section); + this->event = CreateEvent(NULL, FALSE, FALSE, NULL); } /* virtual */ ~ThreadMutex_Win32() { DeleteCriticalSection(&this->critical_section); + CloseHandle(this->event); } /* virtual */ void BeginCritical() @@ -128,6 +131,18 @@ public: { LeaveCriticalSection(&this->critical_section); } + + /* virtual */ void WaitForSignal() + { + this->EndCritical(); + WaitForSingleObject(this->event, INFINITE); + this->BeginCritical(); + } + + /* virtual */ void SendSignal() + { + SetEvent(this->event); + } }; /* static */ ThreadMutex *ThreadMutex::New() |