summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-04-20 21:45:52 +0200
committerSubv <subv2112@gmail.com>2018-04-21 04:04:33 +0200
commitbe155f4d9d410886853c25ffa032ce41a7428337 (patch)
tree0cdfd46181a5639339cbbf7d22ed31d9c1d8486b /src/core/hle/kernel
parentKernel: Remove old and unused Mutex code. (diff)
downloadyuzu-be155f4d9d410886853c25ffa032ce41a7428337.tar
yuzu-be155f4d9d410886853c25ffa032ce41a7428337.tar.gz
yuzu-be155f4d9d410886853c25ffa032ce41a7428337.tar.bz2
yuzu-be155f4d9d410886853c25ffa032ce41a7428337.tar.lz
yuzu-be155f4d9d410886853c25ffa032ce41a7428337.tar.xz
yuzu-be155f4d9d410886853c25ffa032ce41a7428337.tar.zst
yuzu-be155f4d9d410886853c25ffa032ce41a7428337.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/condition_variable.cpp64
-rw-r--r--src/core/hle/kernel/condition_variable.h63
-rw-r--r--src/core/hle/kernel/svc.cpp6
-rw-r--r--src/core/hle/kernel/thread.cpp9
-rw-r--r--src/core/hle/kernel/thread.h6
5 files changed, 0 insertions, 148 deletions
diff --git a/src/core/hle/kernel/condition_variable.cpp b/src/core/hle/kernel/condition_variable.cpp
deleted file mode 100644
index a786d7f74..000000000
--- a/src/core/hle/kernel/condition_variable.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2018 yuzu emulator team
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include "common/assert.h"
-#include "core/hle/kernel/condition_variable.h"
-#include "core/hle/kernel/errors.h"
-#include "core/hle/kernel/kernel.h"
-#include "core/hle/kernel/object_address_table.h"
-#include "core/hle/kernel/thread.h"
-
-namespace Kernel {
-
-ConditionVariable::ConditionVariable() {}
-ConditionVariable::~ConditionVariable() {}
-
-ResultVal<SharedPtr<ConditionVariable>> ConditionVariable::Create(VAddr guest_addr,
- std::string name) {
- SharedPtr<ConditionVariable> condition_variable(new ConditionVariable);
-
- condition_variable->name = std::move(name);
- condition_variable->guest_addr = guest_addr;
- condition_variable->mutex_addr = 0;
-
- // Condition variables are referenced by guest address, so track this in the kernel
- g_object_address_table.Insert(guest_addr, condition_variable);
-
- return MakeResult<SharedPtr<ConditionVariable>>(std::move(condition_variable));
-}
-
-bool ConditionVariable::ShouldWait(Thread* thread) const {
- return GetAvailableCount() <= 0;
-}
-
-void ConditionVariable::Acquire(Thread* thread) {
- if (GetAvailableCount() <= 0)
- return;
-
- SetAvailableCount(GetAvailableCount() - 1);
-}
-
-ResultCode ConditionVariable::Release(s32 target) {
- if (target == -1) {
- // When -1, wake up all waiting threads
- SetAvailableCount(static_cast<s32>(GetWaitingThreads().size()));
- WakeupAllWaitingThreads();
- } else {
- // Otherwise, wake up just a single thread
- SetAvailableCount(target);
- WakeupWaitingThread(GetHighestPriorityReadyThread());
- }
-
- return RESULT_SUCCESS;
-}
-
-s32 ConditionVariable::GetAvailableCount() const {
- return Memory::Read32(guest_addr);
-}
-
-void ConditionVariable::SetAvailableCount(s32 value) const {
- Memory::Write32(guest_addr, value);
-}
-
-} // namespace Kernel
diff --git a/src/core/hle/kernel/condition_variable.h b/src/core/hle/kernel/condition_variable.h
deleted file mode 100644
index 1c9f06769..000000000
--- a/src/core/hle/kernel/condition_variable.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2018 yuzu emulator team
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <string>
-#include <queue>
-#include "common/common_types.h"
-#include "core/hle/kernel/kernel.h"
-#include "core/hle/kernel/wait_object.h"
-#include "core/hle/result.h"
-
-namespace Kernel {
-
-class ConditionVariable final : public WaitObject {
-public:
- /**
- * Creates a condition variable.
- * @param guest_addr Address of the object tracking the condition variable in guest memory. If
- * specified, this condition variable will update the guest object when its state changes.
- * @param name Optional name of condition variable.
- * @return The created condition variable.
- */
- static ResultVal<SharedPtr<ConditionVariable>> Create(VAddr guest_addr,
- std::string name = "Unknown");
-
- std::string GetTypeName() const override {
- return "ConditionVariable";
- }
- std::string GetName() const override {
- return name;
- }
-
- static const HandleType HANDLE_TYPE = HandleType::ConditionVariable;
- HandleType GetHandleType() const override {
- return HANDLE_TYPE;
- }
-
- s32 GetAvailableCount() const;
- void SetAvailableCount(s32 value) const;
-
- std::string name; ///< Name of condition variable (optional)
- VAddr guest_addr; ///< Address of the guest condition variable value
- VAddr mutex_addr; ///< (optional) Address of guest mutex value associated with this condition
- ///< variable, used for implementing events
-
- bool ShouldWait(Thread* thread) const override;
- void Acquire(Thread* thread) override;
-
- /**
- * Releases a slot from a condition variable.
- * @param target The number of threads to wakeup, -1 is all.
- * @return ResultCode indicating if the operation succeeded.
- */
- ResultCode Release(s32 target);
-
-private:
- ConditionVariable();
- ~ConditionVariable() override;
-};
-
-} // namespace Kernel
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 99c1c2d2a..082c36caf 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -13,7 +13,6 @@
#include "core/core_timing.h"
#include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/client_session.h"
-#include "core/hle/kernel/condition_variable.h"
#include "core/hle/kernel/event.h"
#include "core/hle/kernel/handle_table.h"
#include "core/hle/kernel/mutex.h"
@@ -394,11 +393,6 @@ static ResultCode SetThreadPriority(Handle handle, u32 priority) {
}
thread->SetPriority(priority);
- thread->UpdatePriority();
-
- // Update the mutexes that this thread is waiting for
- for (auto& mutex : thread->pending_mutexes)
- mutex->UpdatePriority();
Core::System::GetInstance().PrepareReschedule();
return RESULT_SUCCESS;
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 8093c4496..16d9b9e36 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -329,15 +329,6 @@ void Thread::SetPriority(u32 priority) {
nominal_priority = current_priority = priority;
}
-void Thread::UpdatePriority() {
- u32 best_priority = nominal_priority;
- for (auto& mutex : held_mutexes) {
- if (mutex->priority < best_priority)
- best_priority = mutex->priority;
- }
- BoostPriority(best_priority);
-}
-
void Thread::BoostPriority(u32 priority) {
Core::System::GetInstance().Scheduler().SetThreadPriority(this, priority);
current_priority = priority;
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h
index 74d5904b8..ee13d20f1 100644
--- a/src/core/hle/kernel/thread.h
+++ b/src/core/hle/kernel/thread.h
@@ -104,12 +104,6 @@ public:
void SetPriority(u32 priority);
/**
- * Boost's a thread's priority to the best priority among the thread's held mutexes.
- * This prevents priority inversion via priority inheritance.
- */
- void UpdatePriority();
-
- /**
* Temporarily boosts the thread's priority until the next time it is scheduled
* @param priority The new priority
*/