summaryrefslogtreecommitdiff
path: root/src/thread/thread_win32.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread/thread_win32.cpp')
-rw-r--r--src/thread/thread_win32.cpp56
1 files changed, 0 insertions, 56 deletions
diff --git a/src/thread/thread_win32.cpp b/src/thread/thread_win32.cpp
index 506faa069..fc7a85a91 100644
--- a/src/thread/thread_win32.cpp
+++ b/src/thread/thread_win32.cpp
@@ -109,59 +109,3 @@ private:
if (thread != NULL) *thread = to;
return true;
}
-
-/**
- * Win32 thread version of ThreadMutex.
- */
-class ThreadMutex_Win32 : public ThreadMutex {
-private:
- CRITICAL_SECTION critical_section; ///< The critical section we would enter.
- HANDLE event; ///< Event for signalling.
- uint recursive_count; ///< Recursive lock count.
-
-public:
- ThreadMutex_Win32() : recursive_count(0)
- {
- InitializeCriticalSection(&this->critical_section);
- this->event = CreateEvent(NULL, FALSE, FALSE, NULL);
- }
-
- ~ThreadMutex_Win32() override
- {
- DeleteCriticalSection(&this->critical_section);
- CloseHandle(this->event);
- }
-
- void BeginCritical(bool allow_recursive = false) override
- {
- /* windows mutex is recursive by itself */
- EnterCriticalSection(&this->critical_section);
- this->recursive_count++;
- if (!allow_recursive && this->recursive_count != 1) NOT_REACHED();
- }
-
- void EndCritical(bool allow_recursive = false) override
- {
- if (!allow_recursive && this->recursive_count != 1) NOT_REACHED();
- this->recursive_count--;
- LeaveCriticalSection(&this->critical_section);
- }
-
- void WaitForSignal() override
- {
- assert(this->recursive_count == 1); // Do we need to call Begin/EndCritical multiple times otherwise?
- this->EndCritical();
- WaitForSingleObject(this->event, INFINITE);
- this->BeginCritical();
- }
-
- void SendSignal() override
- {
- SetEvent(this->event);
- }
-};
-
-/* static */ ThreadMutex *ThreadMutex::New()
-{
- return new ThreadMutex_Win32();
-}