diff options
Diffstat (limited to 'src/core/hle/kernel/k_scoped_lock.h')
-rw-r--r-- | src/core/hle/kernel/k_scoped_lock.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/core/hle/kernel/k_scoped_lock.h b/src/core/hle/kernel/k_scoped_lock.h index a15640fd2..629a7d20d 100644 --- a/src/core/hle/kernel/k_scoped_lock.h +++ b/src/core/hle/kernel/k_scoped_lock.h @@ -18,15 +18,15 @@ std::is_reference_v<T>&& requires(T& t) { template <typename T> requires KLockable<T> -class [[nodiscard]] KScopedLock { +class KScopedLock { public: - explicit KScopedLock(T* l) : lock_ptr(l) { - this->lock_ptr->Lock(); + explicit KScopedLock(T* l) : m_lock(*l) {} + explicit KScopedLock(T& l) : m_lock(l) { + m_lock.Lock(); } - explicit KScopedLock(T& l) : KScopedLock(std::addressof(l)) {} ~KScopedLock() { - this->lock_ptr->Unlock(); + m_lock.Unlock(); } KScopedLock(const KScopedLock&) = delete; @@ -36,7 +36,7 @@ public: KScopedLock& operator=(KScopedLock&&) = delete; private: - T* lock_ptr; + T& m_lock; }; } // namespace Kernel |