summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-03-20 03:20:15 +0100
committerFernandoS27 <fsahmkow27@gmail.com>2019-03-27 19:49:43 +0100
commitdb42bcb306323d6221e7f893d39558c3db579bf3 (patch)
treeef23218b123f80a0c2a773908a6fa2685cd34898 /src/core/hle/kernel
parentFixes to multilevelqueue's iterator. (diff)
downloadyuzu-db42bcb306323d6221e7f893d39558c3db579bf3.tar
yuzu-db42bcb306323d6221e7f893d39558c3db579bf3.tar.gz
yuzu-db42bcb306323d6221e7f893d39558c3db579bf3.tar.bz2
yuzu-db42bcb306323d6221e7f893d39558c3db579bf3.tar.lz
yuzu-db42bcb306323d6221e7f893d39558c3db579bf3.tar.xz
yuzu-db42bcb306323d6221e7f893d39558c3db579bf3.tar.zst
yuzu-db42bcb306323d6221e7f893d39558c3db579bf3.zip
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/scheduler.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp
index 58217b732..6d0f13ecf 100644
--- a/src/core/hle/kernel/scheduler.cpp
+++ b/src/core/hle/kernel/scheduler.cpp
@@ -45,10 +45,10 @@ Thread* Scheduler::PopNextReadyThread() {
Thread* next = nullptr;
Thread* thread = GetCurrentThread();
-
if (thread && thread->GetStatus() == ThreadStatus::Running) {
- if (ready_queue.empty())
+ if (ready_queue.empty()) {
return thread;
+ }
// We have to do better than the current thread.
// This call returns null when that's not possible.
next = ready_queue.front();
@@ -56,8 +56,9 @@ Thread* Scheduler::PopNextReadyThread() {
next = thread;
}
} else {
- if (ready_queue.empty())
+ if (ready_queue.empty()) {
return nullptr;
+ }
next = ready_queue.front();
}
@@ -176,8 +177,9 @@ void Scheduler::UnscheduleThread(Thread* thread, u32 priority) {
void Scheduler::SetThreadPriority(Thread* thread, u32 priority) {
std::lock_guard<std::mutex> lock(scheduler_mutex);
- if (thread->GetPriority() == priority)
+ if (thread->GetPriority() == priority) {
return;
+ }
// If thread was ready, adjust queues
if (thread->GetStatus() == ThreadStatus::Ready)
@@ -188,9 +190,10 @@ Thread* Scheduler::GetNextSuggestedThread(u32 core, u32 maximum_priority) const
std::lock_guard<std::mutex> lock(scheduler_mutex);
const u32 mask = 1U << core;
- for (auto& thread : ready_queue) {
- if ((thread->GetAffinityMask() & mask) != 0 && thread->GetPriority() < maximum_priority)
+ for (auto* thread : ready_queue) {
+ if ((thread->GetAffinityMask() & mask) != 0 && thread->GetPriority() < maximum_priority) {
return thread;
+ }
}
return nullptr;
}