diff options
author | bunnei <bunneidev@gmail.com> | 2021-04-21 06:28:11 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2021-05-06 01:40:52 +0200 |
commit | b57c5a9b54b23a348d7e80e51943f27a54fb8c2f (patch) | |
tree | e3f3c81a2fddb94c43b6a1dd641c61a7ca9c8225 /src/core/hle/kernel/k_resource_limit.cpp | |
parent | hle: kernel: svc: Migrate WaitSynchronization. (diff) | |
download | yuzu-b57c5a9b54b23a348d7e80e51943f27a54fb8c2f.tar yuzu-b57c5a9b54b23a348d7e80e51943f27a54fb8c2f.tar.gz yuzu-b57c5a9b54b23a348d7e80e51943f27a54fb8c2f.tar.bz2 yuzu-b57c5a9b54b23a348d7e80e51943f27a54fb8c2f.tar.lz yuzu-b57c5a9b54b23a348d7e80e51943f27a54fb8c2f.tar.xz yuzu-b57c5a9b54b23a348d7e80e51943f27a54fb8c2f.tar.zst yuzu-b57c5a9b54b23a348d7e80e51943f27a54fb8c2f.zip |
Diffstat (limited to 'src/core/hle/kernel/k_resource_limit.cpp')
-rw-r--r-- | src/core/hle/kernel/k_resource_limit.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/core/hle/kernel/k_resource_limit.cpp b/src/core/hle/kernel/k_resource_limit.cpp index d05b34ea3..ad5095bfd 100644 --- a/src/core/hle/kernel/k_resource_limit.cpp +++ b/src/core/hle/kernel/k_resource_limit.cpp @@ -10,10 +10,16 @@ namespace Kernel { constexpr s64 DefaultTimeout = 10000000000; // 10 seconds -KResourceLimit::KResourceLimit(KernelCore& kernel, const Core::Timing::CoreTiming& core_timing_) - : Object{kernel}, lock{kernel}, cond_var{kernel}, core_timing(core_timing_) {} +KResourceLimit::KResourceLimit(KernelCore& kernel) + : KAutoObjectWithSlabHeapAndContainer{kernel}, lock{kernel}, cond_var{kernel} {} KResourceLimit::~KResourceLimit() = default; +void KResourceLimit::Initialize(const Core::Timing::CoreTiming* core_timing_) { + core_timing = core_timing_; +} + +void KResourceLimit::Finalize() {} + s64 KResourceLimit::GetLimitValue(LimitableResource which) const { const auto index = static_cast<std::size_t>(which); s64 value{}; @@ -78,7 +84,7 @@ ResultCode KResourceLimit::SetLimitValue(LimitableResource which, s64 value) { } bool KResourceLimit::Reserve(LimitableResource which, s64 value) { - return Reserve(which, value, core_timing.GetGlobalTimeNs().count() + DefaultTimeout); + return Reserve(which, value, core_timing->GetGlobalTimeNs().count() + DefaultTimeout); } bool KResourceLimit::Reserve(LimitableResource which, s64 value, s64 timeout) { @@ -109,7 +115,7 @@ bool KResourceLimit::Reserve(LimitableResource which, s64 value, s64 timeout) { } if (current_hints[index] + value <= limit_values[index] && - (timeout < 0 || core_timing.GetGlobalTimeNs().count() < timeout)) { + (timeout < 0 || core_timing->GetGlobalTimeNs().count() < timeout)) { waiter_count++; cond_var.Wait(&lock, timeout); waiter_count--; |