diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/chips/common/mutex.hpp | 29 |
2 files changed, 29 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d93901e..2fc91c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,7 +38,7 @@ endif() if(${CMAKE_SYSTEM_NAME} STREQUAL "NintendoWii") set(ADLMIDI_WII 1) - add_definitions(-DDOSBOX_NO_MUTEX) + add_definitions(-DUSE_LIBOGC_MUTEX) endif() #=========================================================================================== 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() |