From 7cfa731bcafb61d464addd829a22a036c382bca8 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Sat, 10 Apr 2021 07:31:38 +0200 Subject: [PATCH] early-access version 1577 --- README.md | 2 +- src/core/hle/kernel/k_scheduler.h | 4 ++-- src/core/hle/kernel/k_scoped_lock.h | 13 ++++++++----- .../hle/kernel/k_scoped_scheduler_lock_and_sleep.h | 4 ++-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9cd90d2a6..3aa1e17a8 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 1576. +This is the source code for early-access 1577. ## Legal Notice diff --git a/src/core/hle/kernel/k_scheduler.h b/src/core/hle/kernel/k_scheduler.h index f1cca51dc..8e32865aa 100755 --- a/src/core/hle/kernel/k_scheduler.h +++ b/src/core/hle/kernel/k_scheduler.h @@ -195,9 +195,9 @@ private: KSpinLock guard{}; }; -class KScopedSchedulerLock : KScopedLock { +class [[nodiscard]] KScopedSchedulerLock : KScopedLock { public: - explicit KScopedSchedulerLock(KernelCore& kernel); + explicit KScopedSchedulerLock(KernelCore & kernel); ~KScopedSchedulerLock(); }; diff --git a/src/core/hle/kernel/k_scoped_lock.h b/src/core/hle/kernel/k_scoped_lock.h index d7cc557b2..72c3b0252 100755 --- a/src/core/hle/kernel/k_scoped_lock.h +++ b/src/core/hle/kernel/k_scoped_lock.h @@ -20,19 +20,22 @@ concept KLockable = !std::is_reference_v && requires(T & t) { }; template -requires KLockable class KScopedLock { +requires KLockable class [[nodiscard]] KScopedLock { public: - explicit KScopedLock(T* l) : lock_ptr(l) { + explicit KScopedLock(T * l) : lock_ptr(l) { this->lock_ptr->Lock(); } - explicit KScopedLock(T& l) : KScopedLock(std::addressof(l)) { /* ... */ - } + explicit KScopedLock(T & l) : KScopedLock(std::addressof(l)) {} + ~KScopedLock() { this->lock_ptr->Unlock(); } KScopedLock(const KScopedLock&) = delete; - KScopedLock(KScopedLock&&) = delete; + KScopedLock& operator=(const KScopedLock&) = delete; + + KScopedLock(KScopedLock &&) = delete; + KScopedLock& operator=(KScopedLock&&) = delete; private: T* lock_ptr; diff --git a/src/core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h b/src/core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h index f8189e107..ebecf0c77 100755 --- a/src/core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h +++ b/src/core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h @@ -15,9 +15,9 @@ namespace Kernel { -class KScopedSchedulerLockAndSleep { +class [[nodiscard]] KScopedSchedulerLockAndSleep { public: - explicit KScopedSchedulerLockAndSleep(KernelCore& kernel, KThread* t, s64 timeout) + explicit KScopedSchedulerLockAndSleep(KernelCore & kernel, KThread * t, s64 timeout) : kernel(kernel), thread(t), timeout_tick(timeout) { // Lock the scheduler. kernel.GlobalSchedulerContext().scheduler_lock.Lock();