diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/kernel/k_scheduler.h | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_scoped_lock.h | 13 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h | 4 |
3 files changed, 12 insertions, 9 deletions
diff --git a/src/core/hle/kernel/k_scheduler.h b/src/core/hle/kernel/k_scheduler.h index f595b9a5c..70d6bfcee 100644 --- a/src/core/hle/kernel/k_scheduler.h +++ b/src/core/hle/kernel/k_scheduler.h | |||
| @@ -198,9 +198,9 @@ private: | |||
| 198 | Common::SpinLock guard{}; | 198 | Common::SpinLock guard{}; |
| 199 | }; | 199 | }; |
| 200 | 200 | ||
| 201 | class KScopedSchedulerLock : KScopedLock<GlobalSchedulerContext::LockType> { | 201 | class [[nodiscard]] KScopedSchedulerLock : KScopedLock<GlobalSchedulerContext::LockType> { |
| 202 | public: | 202 | public: |
| 203 | explicit KScopedSchedulerLock(KernelCore& kernel); | 203 | explicit KScopedSchedulerLock(KernelCore & kernel); |
| 204 | ~KScopedSchedulerLock(); | 204 | ~KScopedSchedulerLock(); |
| 205 | }; | 205 | }; |
| 206 | 206 | ||
diff --git a/src/core/hle/kernel/k_scoped_lock.h b/src/core/hle/kernel/k_scoped_lock.h index d7cc557b2..72c3b0252 100644 --- 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<T> && requires(T & t) { | |||
| 20 | }; | 20 | }; |
| 21 | 21 | ||
| 22 | template <typename T> | 22 | template <typename T> |
| 23 | requires KLockable<T> class KScopedLock { | 23 | requires KLockable<T> class [[nodiscard]] KScopedLock { |
| 24 | public: | 24 | public: |
| 25 | explicit KScopedLock(T* l) : lock_ptr(l) { | 25 | explicit KScopedLock(T * l) : lock_ptr(l) { |
| 26 | this->lock_ptr->Lock(); | 26 | this->lock_ptr->Lock(); |
| 27 | } | 27 | } |
| 28 | explicit KScopedLock(T& l) : KScopedLock(std::addressof(l)) { /* ... */ | 28 | explicit KScopedLock(T & l) : KScopedLock(std::addressof(l)) {} |
| 29 | } | 29 | |
| 30 | ~KScopedLock() { | 30 | ~KScopedLock() { |
| 31 | this->lock_ptr->Unlock(); | 31 | this->lock_ptr->Unlock(); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | KScopedLock(const KScopedLock&) = delete; | 34 | KScopedLock(const KScopedLock&) = delete; |
| 35 | KScopedLock(KScopedLock&&) = delete; | 35 | KScopedLock& operator=(const KScopedLock&) = delete; |
| 36 | |||
| 37 | KScopedLock(KScopedLock &&) = delete; | ||
| 38 | KScopedLock& operator=(KScopedLock&&) = delete; | ||
| 36 | 39 | ||
| 37 | private: | 40 | private: |
| 38 | T* lock_ptr; | 41 | 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 100644 --- 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 @@ | |||
| 15 | 15 | ||
| 16 | namespace Kernel { | 16 | namespace Kernel { |
| 17 | 17 | ||
| 18 | class KScopedSchedulerLockAndSleep { | 18 | class [[nodiscard]] KScopedSchedulerLockAndSleep { |
| 19 | public: | 19 | public: |
| 20 | explicit KScopedSchedulerLockAndSleep(KernelCore& kernel, KThread* t, s64 timeout) | 20 | explicit KScopedSchedulerLockAndSleep(KernelCore & kernel, KThread * t, s64 timeout) |
| 21 | : kernel(kernel), thread(t), timeout_tick(timeout) { | 21 | : kernel(kernel), thread(t), timeout_tick(timeout) { |
| 22 | // Lock the scheduler. | 22 | // Lock the scheduler. |
| 23 | kernel.GlobalSchedulerContext().scheduler_lock.Lock(); | 23 | kernel.GlobalSchedulerContext().scheduler_lock.Lock(); |