summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/process.cpp
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-11-21 16:03:37 +0100
committerFernandoS27 <fsahmkow27@gmail.com>2019-11-21 16:13:29 +0100
commit46bb6099814a6ff404d337164ced016ec04ea7b9 (patch)
tree2ea68335bff35e36fa0999cef430ca022ecaae43 /src/core/hle/kernel/process.cpp
parentKernel: Correct SignalProcessWideKey (diff)
downloadyuzu-46bb6099814a6ff404d337164ced016ec04ea7b9.tar
yuzu-46bb6099814a6ff404d337164ced016ec04ea7b9.tar.gz
yuzu-46bb6099814a6ff404d337164ced016ec04ea7b9.tar.bz2
yuzu-46bb6099814a6ff404d337164ced016ec04ea7b9.tar.lz
yuzu-46bb6099814a6ff404d337164ced016ec04ea7b9.tar.xz
yuzu-46bb6099814a6ff404d337164ced016ec04ea7b9.tar.zst
yuzu-46bb6099814a6ff404d337164ced016ec04ea7b9.zip
Diffstat (limited to 'src/core/hle/kernel/process.cpp')
-rw-r--r--src/core/hle/kernel/process.cpp38
1 files changed, 17 insertions, 21 deletions
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp
index 43576c6ab..a4e0dd385 100644
--- a/src/core/hle/kernel/process.cpp
+++ b/src/core/hle/kernel/process.cpp
@@ -143,31 +143,28 @@ u64 Process::GetTotalPhysicalMemoryUsedWithoutSystemResource() const {
}
void Process::InsertConditionVariableThread(SharedPtr<Thread> thread) {
- auto it = cond_var_threads.begin();
- while (it != cond_var_threads.end()) {
+ VAddr cond_var_addr = thread->GetCondVarWaitAddress();
+ std::list<SharedPtr<Thread>>& thread_list = cond_var_threads[cond_var_addr];
+ auto it = thread_list.begin();
+ while (it != thread_list.end()) {
const SharedPtr<Thread> current_thread = *it;
- if (current_thread->GetCondVarWaitAddress() < thread->GetCondVarWaitAddress()) {
- if (current_thread->GetCondVarWaitAddress() == thread->GetCondVarWaitAddress()) {
- if (current_thread->GetPriority() > thread->GetPriority()) {
- cond_var_threads.insert(it, thread);
- return;
- }
- } else {
- cond_var_threads.insert(it, thread);
- return;
- }
+ if (current_thread->GetPriority() > thread->GetPriority()) {
+ thread_list.insert(it, thread);
+ return;
}
++it;
}
- cond_var_threads.push_back(thread);
+ thread_list.push_back(thread);
}
void Process::RemoveConditionVariableThread(SharedPtr<Thread> thread) {
- auto it = cond_var_threads.begin();
- while (it != cond_var_threads.end()) {
+ VAddr cond_var_addr = thread->GetCondVarWaitAddress();
+ std::list<SharedPtr<Thread>>& thread_list = cond_var_threads[cond_var_addr];
+ auto it = thread_list.begin();
+ while (it != thread_list.end()) {
const SharedPtr<Thread> current_thread = *it;
if (current_thread.get() == thread.get()) {
- cond_var_threads.erase(it);
+ thread_list.erase(it);
return;
}
++it;
@@ -177,12 +174,11 @@ void Process::RemoveConditionVariableThread(SharedPtr<Thread> thread) {
std::vector<SharedPtr<Thread>> Process::GetConditionVariableThreads(const VAddr cond_var_addr) {
std::vector<SharedPtr<Thread>> result{};
- auto it = cond_var_threads.begin();
- while (it != cond_var_threads.end()) {
+ std::list<SharedPtr<Thread>>& thread_list = cond_var_threads[cond_var_addr];
+ auto it = thread_list.begin();
+ while (it != thread_list.end()) {
SharedPtr<Thread> current_thread = *it;
- if (current_thread->GetCondVarWaitAddress() == cond_var_addr) {
- result.push_back(current_thread);
- }
+ result.push_back(current_thread);
++it;
}
return result;