aboutsummaryrefslogtreecommitdiff
path: root/src/chips
diff options
context:
space:
mode:
authorWohlstand <admin@wohlnet.ru>2022-03-11 02:30:26 +0300
committerWohlstand <admin@wohlnet.ru>2022-03-11 02:30:26 +0300
commit1183acbc77370e000efafcaa5c596fe652eb7efd (patch)
tree1bb930986630e956a71b20d8994a66c8b042811a /src/chips
parentdf5e66f6eb5ea0998e593870b0d68ac56033c686 (diff)
downloadlibADLMIDI-1183acbc77370e000efafcaa5c596fe652eb7efd.tar.gz
libADLMIDI-1183acbc77370e000efafcaa5c596fe652eb7efd.tar.bz2
libADLMIDI-1183acbc77370e000efafcaa5c596fe652eb7efd.zip
Use LWP_Mutex API from libOGC where needed
Diffstat (limited to 'src/chips')
-rw-r--r--src/chips/common/mutex.hpp29
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()