From 54f4a68c7065a1ba1b4daf9644a7c11215ef5e94 Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Fri, 23 Dec 2022 09:53:40 +0300 Subject: Misc: Added WUT mutex support --- src/chips/common/mutex.hpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/chips') diff --git a/src/chips/common/mutex.hpp b/src/chips/common/mutex.hpp index 02ad1c7..a8d23b2 100644 --- a/src/chips/common/mutex.hpp +++ b/src/chips/common/mutex.hpp @@ -25,6 +25,12 @@ # if defined(USE_LIBOGC_MUTEX) # include typedef mutex_t MutexNativeObject; +# elif defined(USE_WUT_MUTEX) +# if __cplusplus < 201103L || (defined(_MSC_VER) && _MSC_VER < 1900) +# define static_assert(x, y) +# endif +# include +typedef OSMutex MutexNativeObject; # elif !defined(_WIN32) # include typedef pthread_mutex_t MutexNativeObject; @@ -75,6 +81,26 @@ inline void Mutex::lock() inline void Mutex::unlock() {} +#elif defined(USE_WUT_MUTEX) + +inline Mutex::Mutex() +{ + OSInitMutex(&m); +} + +inline Mutex::~Mutex() +{} + +inline void Mutex::lock() +{ + OSLockMutex(&m); +} + +inline void Mutex::unlock() +{ + OSUnlockMutex(&m); +} + #elif defined(USE_LIBOGC_MUTEX) inline Mutex::Mutex() -- cgit v1.2.3