diff options
| author | Robert Göffringmann | 2008-03-03 00:41:59 +0000 |
|---|---|---|
| committer | Robert Göffringmann | 2008-03-03 00:41:59 +0000 |
| commit | 3b27b9fa438611c3a05fcf2d07a3dfde6be192fa (patch) | |
| tree | 8605c47d67b779fb33ce4dda3a64a7d3caecdb4d /backends/platform/ps2/ps2mutex.cpp | |
| parent | fc91de07dfdfe6bd29edadf739f324f30f5624d0 (diff) | |
| download | scummvm-rg350-3b27b9fa438611c3a05fcf2d07a3dfde6be192fa.tar.gz scummvm-rg350-3b27b9fa438611c3a05fcf2d07a3dfde6be192fa.tar.bz2 scummvm-rg350-3b27b9fa438611c3a05fcf2d07a3dfde6be192fa.zip | |
the ps2 changes from the 0.11.1 release, plus some bugfixes and cleanup.
svn-id: r31034
Diffstat (limited to 'backends/platform/ps2/ps2mutex.cpp')
| -rw-r--r-- | backends/platform/ps2/ps2mutex.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/backends/platform/ps2/ps2mutex.cpp b/backends/platform/ps2/ps2mutex.cpp index e270599013..fe76202f32 100644 --- a/backends/platform/ps2/ps2mutex.cpp +++ b/backends/platform/ps2/ps2mutex.cpp @@ -25,6 +25,17 @@ #include "backends/platform/ps2/systemps2.h" +void OSystem_PS2::initMutexes(void) { + ee_sema_t newSema; + newSema.init_count = 1; + newSema.max_count = 1; + _mutexSema = CreateSema(&newSema); + for (int i = 0; i < MAX_MUTEXES; i++) { + _mutex[i].sema = -1; + _mutex[i].count = _mutex[i].owner = 0; + } +} + OSystem::MutexRef OSystem_PS2::createMutex(void) { WaitSema(_mutexSema); Ps2Mutex *mutex = NULL; @@ -49,6 +60,7 @@ void OSystem_PS2::lockMutex(MutexRef mutex) { WaitSema(_mutexSema); Ps2Mutex *sysMutex = (Ps2Mutex*)mutex; int tid = GetThreadId(); + assert(tid != 0); if (sysMutex->owner && (sysMutex->owner == tid)) sysMutex->count++; @@ -66,6 +78,7 @@ void OSystem_PS2::unlockMutex(MutexRef mutex) { WaitSema(_mutexSema); Ps2Mutex *sysMutex = (Ps2Mutex*)mutex; int tid = GetThreadId(); + if (sysMutex->owner && sysMutex->count && (sysMutex->owner == tid)) sysMutex->count--; else { |
