diff options
Diffstat (limited to 'src/thread/thread_os2.cpp')
-rw-r--r-- | src/thread/thread_os2.cpp | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/thread/thread_os2.cpp b/src/thread/thread_os2.cpp index 976283f23..72ee080d6 100644 --- a/src/thread/thread_os2.cpp +++ b/src/thread/thread_os2.cpp @@ -89,59 +89,3 @@ private: if (thread != NULL) *thread = to; return true; } - -/** - * OS/2 version of ThreadMutex. - */ -class ThreadMutex_OS2 : public ThreadMutex { -private: - HMTX mutex; ///< The mutex. - HEV event; ///< Event for waiting. - uint recursive_count; ///< Recursive lock count. - -public: - ThreadMutex_OS2() : recursive_count(0) - { - DosCreateMutexSem(NULL, &mutex, 0, FALSE); - DosCreateEventSem(NULL, &event, 0, FALSE); - } - - ~ThreadMutex_OS2() override - { - DosCloseMutexSem(mutex); - DosCloseEventSem(event); - } - - void BeginCritical(bool allow_recursive = false) override - { - /* os2 mutex is recursive by itself */ - DosRequestMutexSem(mutex, (unsigned long) SEM_INDEFINITE_WAIT); - 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--; - DosReleaseMutexSem(mutex); - } - - void WaitForSignal() override - { - assert(this->recursive_count == 1); // Do we need to call Begin/EndCritical multiple times otherwise? - this->EndCritical(); - DosWaitEventSem(event, SEM_INDEFINITE_WAIT); - this->BeginCritical(); - } - - void SendSignal() override - { - DosPostEventSem(event); - } -}; - -/* static */ ThreadMutex *ThreadMutex::New() -{ - return new ThreadMutex_OS2(); -} |