diff options
author | Wohlstand <admin@wohlnet.ru> | 2022-03-11 02:30:26 +0300 |
---|---|---|
committer | Wohlstand <admin@wohlnet.ru> | 2022-03-11 02:30:26 +0300 |
commit | 1183acbc77370e000efafcaa5c596fe652eb7efd (patch) | |
tree | 1bb930986630e956a71b20d8994a66c8b042811a | |
parent | df5e66f6eb5ea0998e593870b0d68ac56033c686 (diff) | |
download | libADLMIDI-1183acbc77370e000efafcaa5c596fe652eb7efd.tar.gz libADLMIDI-1183acbc77370e000efafcaa5c596fe652eb7efd.tar.bz2 libADLMIDI-1183acbc77370e000efafcaa5c596fe652eb7efd.zip |
Use LWP_Mutex API from libOGC where needed
-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() |