mirror of
https://github.com/starr-dusT/yuzu-mainline
synced 2024-03-05 21:12:25 -08:00
hle: kernel: KScopedLock: Various style fixes based on code review feedback.
This commit is contained in:
parent
165d8485f0
commit
b1b4f2337e
@ -12,7 +12,7 @@
|
|||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept KLockable = !std::is_reference<T>::value && requires(T & t) {
|
concept KLockable = !std::is_reference_v<T> && requires(T & t) {
|
||||||
{ t.Lock() }
|
{ t.Lock() }
|
||||||
->std::same_as<void>;
|
->std::same_as<void>;
|
||||||
{ t.Unlock() }
|
{ t.Unlock() }
|
||||||
@ -20,11 +20,7 @@ concept KLockable = !std::is_reference<T>::value && requires(T & t) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
requires KLockable<T> class KScopedLock : NonCopyable {
|
requires KLockable<T> class KScopedLock {
|
||||||
|
|
||||||
private:
|
|
||||||
T* lock_ptr;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit KScopedLock(T* l) : lock_ptr(l) {
|
explicit KScopedLock(T* l) : lock_ptr(l) {
|
||||||
this->lock_ptr->Lock();
|
this->lock_ptr->Lock();
|
||||||
@ -34,6 +30,12 @@ public:
|
|||||||
~KScopedLock() {
|
~KScopedLock() {
|
||||||
this->lock_ptr->Unlock();
|
this->lock_ptr->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KScopedLock(const KScopedLock&) = delete;
|
||||||
|
KScopedLock(KScopedLock&&) = delete;
|
||||||
|
|
||||||
|
private:
|
||||||
|
T* lock_ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
Loading…
Reference in New Issue
Block a user