diff options
| author | 2021-02-02 13:23:00 +1100 | |
|---|---|---|
| committer | 2021-02-02 13:23:00 +1100 | |
| commit | 9e4b2d60bc4827552b0d74675ae03fec06f73452 (patch) | |
| tree | 99b841a8e2cd6bf70117bb7e93a8719dafa3f726 | |
| parent | fix compile error (diff) | |
| download | yuzu-9e4b2d60bc4827552b0d74675ae03fec06f73452.tar.gz yuzu-9e4b2d60bc4827552b0d74675ae03fec06f73452.tar.xz yuzu-9e4b2d60bc4827552b0d74675ae03fec06f73452.zip | |
Address issues
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/kernel/k_light_condition_variable.h | 21 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_resource_limit.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_resource_limit.h | 11 |
3 files changed, 15 insertions, 19 deletions
diff --git a/src/core/hle/kernel/k_light_condition_variable.h b/src/core/hle/kernel/k_light_condition_variable.h index 26573a239..26d94d7c0 100644 --- a/src/core/hle/kernel/k_light_condition_variable.h +++ b/src/core/hle/kernel/k_light_condition_variable.h | |||
| @@ -17,44 +17,41 @@ namespace Kernel { | |||
| 17 | class KernelCore; | 17 | class KernelCore; |
| 18 | 18 | ||
| 19 | class KLightConditionVariable { | 19 | class KLightConditionVariable { |
| 20 | private: | ||
| 21 | KThreadQueue m_thread_queue; | ||
| 22 | |||
| 23 | public: | 20 | public: |
| 24 | KLightConditionVariable(KernelCore& kernel) : m_thread_queue(kernel), kernel(kernel) {} | 21 | explicit KLightConditionVariable(KernelCore& kernel) : thread_queue(kernel), kernel(kernel) {} |
| 25 | 22 | ||
| 26 | void Wait(KLightLock* lock, s64 timeout = -1ll) { | 23 | void Wait(KLightLock* lock, s64 timeout = -1) { |
| 27 | WaitImpl(lock, timeout); | 24 | WaitImpl(lock, timeout); |
| 28 | lock->Lock(); | 25 | lock->Lock(); |
| 29 | } | 26 | } |
| 30 | 27 | ||
| 31 | void Broadcast() { | 28 | void Broadcast() { |
| 32 | KScopedSchedulerLock lk{kernel}; | 29 | KScopedSchedulerLock lk{kernel}; |
| 33 | while (m_thread_queue.WakeupFrontThread() != nullptr) { | 30 | while (thread_queue.WakeupFrontThread() != nullptr) { |
| 34 | /* We want to signal all threads, and so should continue waking up until there's nothing | 31 | // We want to signal all threads, and so should continue waking up until there's nothing |
| 35 | * to wake. */ | 32 | // to wake. |
| 36 | } | 33 | } |
| 37 | } | 34 | } |
| 38 | 35 | ||
| 39 | private: | 36 | private: |
| 40 | void WaitImpl(KLightLock* lock, s64 timeout) { | 37 | void WaitImpl(KLightLock* lock, s64 timeout) { |
| 41 | KThread* owner = GetCurrentThreadPointer(kernel); | 38 | KThread* owner = GetCurrentThreadPointer(kernel); |
| 42 | // KHardwareTimer* timer; | ||
| 43 | 39 | ||
| 44 | /* Sleep the thread. */ | 40 | // Sleep the thread. |
| 45 | { | 41 | { |
| 46 | KScopedSchedulerLockAndSleep lk(kernel, owner, timeout); | 42 | KScopedSchedulerLockAndSleep lk(kernel, owner, timeout); |
| 47 | lock->Unlock(); | 43 | lock->Unlock(); |
| 48 | 44 | ||
| 49 | if (!m_thread_queue.SleepThread(owner)) { | 45 | if (!thread_queue.SleepThread(owner)) { |
| 50 | lk.CancelSleep(); | 46 | lk.CancelSleep(); |
| 51 | return; | 47 | return; |
| 52 | } | 48 | } |
| 53 | } | 49 | } |
| 54 | 50 | ||
| 55 | /* Cancel the task that the sleep setup. */ | 51 | // Cancel the task that the sleep setup. |
| 56 | kernel.TimeManager().UnscheduleTimeEvent(owner); | 52 | kernel.TimeManager().UnscheduleTimeEvent(owner); |
| 57 | } | 53 | } |
| 58 | KernelCore& kernel; | 54 | KernelCore& kernel; |
| 55 | KThreadQueue thread_queue; | ||
| 59 | }; | 56 | }; |
| 60 | } // namespace Kernel | 57 | } // namespace Kernel |
diff --git a/src/core/hle/kernel/k_resource_limit.cpp b/src/core/hle/kernel/k_resource_limit.cpp index 3cee8d0f7..ab2ab683f 100644 --- a/src/core/hle/kernel/k_resource_limit.cpp +++ b/src/core/hle/kernel/k_resource_limit.cpp | |||
| @@ -13,9 +13,7 @@ | |||
| 13 | #include "core/hle/kernel/svc_results.h" | 13 | #include "core/hle/kernel/svc_results.h" |
| 14 | 14 | ||
| 15 | namespace Kernel { | 15 | namespace Kernel { |
| 16 | namespace { | ||
| 17 | constexpr s64 DefaultTimeout = 10000000000; // 10 seconds | 16 | constexpr s64 DefaultTimeout = 10000000000; // 10 seconds |
| 18 | } | ||
| 19 | 17 | ||
| 20 | KResourceLimit::KResourceLimit(KernelCore& kernel, Core::System& system) | 18 | KResourceLimit::KResourceLimit(KernelCore& kernel, Core::System& system) |
| 21 | : Object{kernel}, lock{kernel}, cond_var{kernel}, kernel{kernel}, system(system) {} | 19 | : Object{kernel}, lock{kernel}, cond_var{kernel}, kernel{kernel}, system(system) {} |
diff --git a/src/core/hle/kernel/k_resource_limit.h b/src/core/hle/kernel/k_resource_limit.h index 5f916c99c..6b3437ea6 100644 --- a/src/core/hle/kernel/k_resource_limit.h +++ b/src/core/hle/kernel/k_resource_limit.h | |||
| @@ -37,7 +37,7 @@ constexpr bool IsValidResourceType(LimitableResource type) { | |||
| 37 | 37 | ||
| 38 | class KResourceLimit final : public Object { | 38 | class KResourceLimit final : public Object { |
| 39 | public: | 39 | public: |
| 40 | KResourceLimit(KernelCore& kernel, Core::System& system); | 40 | explicit KResourceLimit(KernelCore& kernel, Core::System& system); |
| 41 | ~KResourceLimit(); | 41 | ~KResourceLimit(); |
| 42 | 42 | ||
| 43 | s64 GetLimitValue(LimitableResource which) const; | 43 | s64 GetLimitValue(LimitableResource which) const; |
| @@ -67,10 +67,11 @@ public: | |||
| 67 | virtual void Finalize() override {} | 67 | virtual void Finalize() override {} |
| 68 | 68 | ||
| 69 | private: | 69 | private: |
| 70 | std::array<s64, static_cast<std::size_t>(LimitableResource::Count)> limit_values{}; | 70 | using ResourceArray = std::array<s64, static_cast<std::size_t>(LimitableResource::Count)>; |
| 71 | std::array<s64, static_cast<std::size_t>(LimitableResource::Count)> current_values{}; | 71 | ResourceArray limit_values{}; |
| 72 | std::array<s64, static_cast<std::size_t>(LimitableResource::Count)> current_hints{}; | 72 | ResourceArray current_values{}; |
| 73 | std::array<s64, static_cast<std::size_t>(LimitableResource::Count)> peak_values{}; | 73 | ResourceArray current_hints{}; |
| 74 | ResourceArray peak_values{}; | ||
| 74 | mutable KLightLock lock; | 75 | mutable KLightLock lock; |
| 75 | s32 waiter_count{}; | 76 | s32 waiter_count{}; |
| 76 | KLightConditionVariable cond_var; | 77 | KLightConditionVariable cond_var; |