Răsfoiți Sursa

Drop m_ from lock

Chloe Marcec 5 ani în urmă
părinte
comite
7791cfd960

+ 8 - 8
src/core/hle/kernel/k_resource_limit.cpp

@@ -18,14 +18,14 @@ constexpr s64 DefaultTimeout = 10000000000; // 10 seconds
 }
 }
 
 
 KResourceLimit::KResourceLimit(KernelCore& kernel, Core::System& system)
 KResourceLimit::KResourceLimit(KernelCore& kernel, Core::System& system)
-    : Object{kernel}, m_lock{kernel}, cond_var{kernel}, kernel{kernel}, system(system) {}
+    : Object{kernel}, lock{kernel}, cond_var{kernel}, kernel{kernel}, system(system) {}
 KResourceLimit::~KResourceLimit() = default;
 KResourceLimit::~KResourceLimit() = default;
 
 
 s64 KResourceLimit::GetLimitValue(LimitableResource which) const {
 s64 KResourceLimit::GetLimitValue(LimitableResource which) const {
     const auto index = static_cast<std::size_t>(which);
     const auto index = static_cast<std::size_t>(which);
     s64 value{};
     s64 value{};
     {
     {
-        KScopedLightLock lk{m_lock};
+        KScopedLightLock lk{lock};
         value = limit_values[index];
         value = limit_values[index];
         ASSERT(value >= 0);
         ASSERT(value >= 0);
         ASSERT(current_values[index] <= limit_values[index]);
         ASSERT(current_values[index] <= limit_values[index]);
@@ -51,7 +51,7 @@ s64 KResourceLimit::GetPeakValue(LimitableResource which) const {
     const auto index = static_cast<std::size_t>(which);
     const auto index = static_cast<std::size_t>(which);
     s64 value{};
     s64 value{};
     {
     {
-        KScopedLightLock lk{m_lock};
+        KScopedLightLock lk{lock};
         value = peak_values[index];
         value = peak_values[index];
         ASSERT(value >= 0);
         ASSERT(value >= 0);
         ASSERT(current_values[index] <= limit_values[index]);
         ASSERT(current_values[index] <= limit_values[index]);
@@ -64,7 +64,7 @@ s64 KResourceLimit::GetFreeValue(LimitableResource which) const {
     const auto index = static_cast<std::size_t>(which);
     const auto index = static_cast<std::size_t>(which);
     s64 value{};
     s64 value{};
     {
     {
-        KScopedLightLock lk(m_lock);
+        KScopedLightLock lk(lock);
         ASSERT(current_values[index] >= 0);
         ASSERT(current_values[index] >= 0);
         ASSERT(current_values[index] <= limit_values[index]);
         ASSERT(current_values[index] <= limit_values[index]);
         ASSERT(current_hints[index] <= current_values[index]);
         ASSERT(current_hints[index] <= current_values[index]);
@@ -76,7 +76,7 @@ s64 KResourceLimit::GetFreeValue(LimitableResource which) const {
 
 
 ResultCode KResourceLimit::SetLimitValue(LimitableResource which, s64 value) {
 ResultCode KResourceLimit::SetLimitValue(LimitableResource which, s64 value) {
     const auto index = static_cast<std::size_t>(which);
     const auto index = static_cast<std::size_t>(which);
-    KScopedLightLock lk(m_lock);
+    KScopedLightLock lk(lock);
     R_UNLESS(current_values[index] <= value, Svc::ResultInvalidState);
     R_UNLESS(current_values[index] <= value, Svc::ResultInvalidState);
 
 
     limit_values[index] = value;
     limit_values[index] = value;
@@ -91,7 +91,7 @@ bool KResourceLimit::Reserve(LimitableResource which, s64 value) {
 bool KResourceLimit::Reserve(LimitableResource which, s64 value, s64 timeout) {
 bool KResourceLimit::Reserve(LimitableResource which, s64 value, s64 timeout) {
     ASSERT(value >= 0);
     ASSERT(value >= 0);
     const auto index = static_cast<std::size_t>(which);
     const auto index = static_cast<std::size_t>(which);
-    KScopedLightLock lk(m_lock);
+    KScopedLightLock lk(lock);
 
 
     ASSERT(current_hints[index] <= current_values[index]);
     ASSERT(current_hints[index] <= current_values[index]);
     if (current_hints[index] >= limit_values[index]) {
     if (current_hints[index] >= limit_values[index]) {
@@ -118,7 +118,7 @@ bool KResourceLimit::Reserve(LimitableResource which, s64 value, s64 timeout) {
         if (current_hints[index] + value <= limit_values[index] &&
         if (current_hints[index] + value <= limit_values[index] &&
             (timeout < 0 || system.CoreTiming().GetGlobalTimeNs().count() < timeout)) {
             (timeout < 0 || system.CoreTiming().GetGlobalTimeNs().count() < timeout)) {
             waiter_count++;
             waiter_count++;
-            cond_var.Wait(&m_lock, timeout);
+            cond_var.Wait(&lock, timeout);
             waiter_count--;
             waiter_count--;
         } else {
         } else {
             break;
             break;
@@ -137,7 +137,7 @@ void KResourceLimit::Release(LimitableResource which, s64 value, s64 hint) {
     ASSERT(hint >= 0);
     ASSERT(hint >= 0);
 
 
     const auto index = static_cast<std::size_t>(which);
     const auto index = static_cast<std::size_t>(which);
-    KScopedLightLock lk(m_lock);
+    KScopedLightLock lk(lock);
     ASSERT(current_values[index] <= limit_values[index]);
     ASSERT(current_values[index] <= limit_values[index]);
     ASSERT(current_hints[index] <= current_values[index]);
     ASSERT(current_hints[index] <= current_values[index]);
     ASSERT(value <= current_values[index]);
     ASSERT(value <= current_values[index]);

+ 1 - 1
src/core/hle/kernel/k_resource_limit.h

@@ -71,7 +71,7 @@ private:
     std::array<s64, static_cast<std::size_t>(LimitableResource::Count)> current_values{};
     std::array<s64, static_cast<std::size_t>(LimitableResource::Count)> current_values{};
     std::array<s64, static_cast<std::size_t>(LimitableResource::Count)> current_hints{};
     std::array<s64, static_cast<std::size_t>(LimitableResource::Count)> current_hints{};
     std::array<s64, static_cast<std::size_t>(LimitableResource::Count)> peak_values{};
     std::array<s64, static_cast<std::size_t>(LimitableResource::Count)> peak_values{};
-    mutable KLightLock m_lock;
+    mutable KLightLock lock;
     s32 waiter_count{};
     s32 waiter_count{};
     KLightConditionVariable cond_var;
     KLightConditionVariable cond_var;
     KernelCore& kernel;
     KernelCore& kernel;