summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororudge <orudge@openttd.org>2009-12-29 04:27:39 +0000
committerorudge <orudge@openttd.org>2009-12-29 04:27:39 +0000
commit00ede07b133e435b3fcdaf8e83ad0e1ec6a7a808 (patch)
treee257f3b7bde8ab2920111da33b1d6c537fe36243
parent1f2159b54eb75826a498c7389d4abde868645bbe (diff)
downloadopenttd-00ede07b133e435b3fcdaf8e83ad0e1ec6a7a808.tar.xz
(svn r18656) -Feature: Add event semaphore support for OS/2
-rw-r--r--src/thread/thread_os2.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/thread/thread_os2.cpp b/src/thread/thread_os2.cpp
index 1145e8e41..c6c7db7df 100644
--- a/src/thread/thread_os2.cpp
+++ b/src/thread/thread_os2.cpp
@@ -94,16 +94,19 @@ private:
class ThreadMutex_OS2 : public ThreadMutex {
private:
HMTX mutex;
+ HEV event;
public:
ThreadMutex_OS2()
{
DosCreateMutexSem(NULL, &mutex, 0, FALSE);
+ DosCreateEventSem(NULL, &event, 0, FALSE);
}
/* virtual */ ~ThreadMutex_OS2()
{
DosCloseMutexSem(mutex);
+ DosCloseEventSem(event);
}
/* virtual */ void BeginCritical()
@@ -115,6 +118,18 @@ public:
{
DosReleaseMutexSem(mutex);
}
+
+ /* virtual */ void WaitForSignal()
+ {
+ this->EndCritical();
+ DosWaitEventSem(event, SEM_INDEFINITE_WAIT);
+ this->BeginCritical();
+ }
+
+ /* virtual */ void SendSignal()
+ {
+ DosPostEventSem(event);
+ }
};
/* static */ ThreadMutex *ThreadMutex::New()