mirror of
https://github.com/wiiu-env/libmocha.git
synced 2024-11-18 01:19:24 +01:00
26 lines
381 B
C++
26 lines
381 B
C++
#pragma once
|
|
|
|
#include "coreinit/cache.h"
|
|
#include <coreinit/mutex.h>
|
|
|
|
class MutexWrapper {
|
|
public:
|
|
MutexWrapper() = default;
|
|
|
|
void init(const char *name) {
|
|
OSInitMutexEx(&mutex, name);
|
|
}
|
|
|
|
void lock() {
|
|
OSLockMutex(&mutex);
|
|
}
|
|
|
|
void unlock() {
|
|
OSUnlockMutex(&mutex);
|
|
OSMemoryBarrier();
|
|
}
|
|
|
|
private:
|
|
OSMutex mutex{};
|
|
};
|