(svn r18656) -Feature: Add event semaphore support for OS/2

This commit is contained in:
orudge 2009-12-29 04:27:39 +00:00
parent 1f2159b54e
commit 00ede07b13
1 changed files with 15 additions and 0 deletions

View File

@ -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()