os: implement SdkRecursiveMutex

This commit is contained in:
Michael Scire 2021-09-29 14:56:53 -07:00
parent c949779b3d
commit b25218c918
7 changed files with 226 additions and 22 deletions

View file

@ -42,15 +42,15 @@ namespace ams::os {
private:
friend class SdkConditionVariable;
private:
SdkMutexType mutex;
SdkMutexType m_mutex;
public:
constexpr SdkMutex() : mutex{{0}} { /* ... */ }
constexpr SdkMutex() : m_mutex{{0}} { /* ... */ }
ALWAYS_INLINE void Lock() { return os::LockSdkMutex(std::addressof(this->mutex)); }
ALWAYS_INLINE bool TryLock() { return os::TryLockSdkMutex(std::addressof(this->mutex)); }
ALWAYS_INLINE void Unlock() { return os::UnlockSdkMutex(std::addressof(this->mutex)); }
ALWAYS_INLINE void Lock() { return os::LockSdkMutex(std::addressof(m_mutex)); }
ALWAYS_INLINE bool TryLock() { return os::TryLockSdkMutex(std::addressof(m_mutex)); }
ALWAYS_INLINE void Unlock() { return os::UnlockSdkMutex(std::addressof(m_mutex)); }
ALWAYS_INLINE bool IsLockedByCurrentThread() const { return os::IsSdkMutexLockedByCurrentThread(std::addressof(this->mutex)); }
ALWAYS_INLINE bool IsLockedByCurrentThread() const { return os::IsSdkMutexLockedByCurrentThread(std::addressof(m_mutex)); }
ALWAYS_INLINE void lock() { return this->Lock(); }
ALWAYS_INLINE bool try_lock() { return this->TryLock(); }