diff options
Diffstat (limited to 'src/chips')
-rw-r--r-- | src/chips/common/mutex.hpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/chips/common/mutex.hpp b/src/chips/common/mutex.hpp index 89d49b0..02ad1c7 100644 --- a/src/chips/common/mutex.hpp +++ b/src/chips/common/mutex.hpp @@ -22,7 +22,10 @@ */ #ifndef DOSBOX_NO_MUTEX -# if !defined(_WIN32) +# if defined(USE_LIBOGC_MUTEX) +# include <ogc/mutex.h> +typedef mutex_t MutexNativeObject; +# elif !defined(_WIN32) # include <pthread.h> typedef pthread_mutex_t MutexNativeObject; # else @@ -31,6 +34,7 @@ typedef CRITICAL_SECTION MutexNativeObject; # endif #endif + class Mutex { public: @@ -71,6 +75,29 @@ inline void Mutex::lock() inline void Mutex::unlock() {} +#elif defined(USE_LIBOGC_MUTEX) + +inline Mutex::Mutex() +{ + m = LWP_MUTEX_NULL; + LWP_MutexInit(&m, 0); +} + +inline Mutex::~Mutex() +{ + LWP_MutexDestroy(m); +} + +inline void Mutex::lock() +{ + LWP_MutexLock(m); +} + +inline void Mutex::unlock() +{ + LWP_MutexUnlock(m); +} + #elif !defined(_WIN32) // pthread inline Mutex::Mutex() |