summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/scheduler.cpp
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2019-03-19 22:20:15 -0400
committerGravatar FernandoS272019-03-27 14:49:43 -0400
commitdb42bcb306323d6221e7f893d39558c3db579bf3 (patch)
treeef23218b123f80a0c2a773908a6fa2685cd34898 /src/core/hle/kernel/scheduler.cpp
parentFixes to multilevelqueue's iterator. (diff)
downloadyuzu-db42bcb306323d6221e7f893d39558c3db579bf3.tar.gz
yuzu-db42bcb306323d6221e7f893d39558c3db579bf3.tar.xz
yuzu-db42bcb306323d6221e7f893d39558c3db579bf3.zip
Fixes and corrections on formatting.
Diffstat (limited to 'src/core/hle/kernel/scheduler.cpp')
-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() {
45 Thread* next = nullptr; 45 Thread* next = nullptr;
46 Thread* thread = GetCurrentThread(); 46 Thread* thread = GetCurrentThread();
47 47
48
49 if (thread && thread->GetStatus() == ThreadStatus::Running) { 48 if (thread && thread->GetStatus() == ThreadStatus::Running) {
50 if (ready_queue.empty()) 49 if (ready_queue.empty()) {
51 return thread; 50 return thread;
51 }
52 // We have to do better than the current thread. 52 // We have to do better than the current thread.
53 // This call returns null when that's not possible. 53 // This call returns null when that's not possible.
54 next = ready_queue.front(); 54 next = ready_queue.front();
@@ -56,8 +56,9 @@ Thread* Scheduler::PopNextReadyThread() {
56 next = thread; 56 next = thread;
57 } 57 }
58 } else { 58 } else {
59 if (ready_queue.empty()) 59 if (ready_queue.empty()) {
60 return nullptr; 60 return nullptr;
61 }
61 next = ready_queue.front(); 62 next = ready_queue.front();
62 } 63 }
63 64
@@ -176,8 +177,9 @@ void Scheduler::UnscheduleThread(Thread* thread, u32 priority) {
176 177
177void Scheduler::SetThreadPriority(Thread* thread, u32 priority) { 178void Scheduler::SetThreadPriority(Thread* thread, u32 priority) {
178 std::lock_guard<std::mutex> lock(scheduler_mutex); 179 std::lock_guard<std::mutex> lock(scheduler_mutex);
179 if (thread->GetPriority() == priority) 180 if (thread->GetPriority() == priority) {
180 return; 181 return;
182 }
181 183
182 // If thread was ready, adjust queues 184 // If thread was ready, adjust queues
183 if (thread->GetStatus() == ThreadStatus::Ready) 185 if (thread->GetStatus() == ThreadStatus::Ready)
@@ -188,9 +190,10 @@ Thread* Scheduler::GetNextSuggestedThread(u32 core, u32 maximum_priority) const
188 std::lock_guard<std::mutex> lock(scheduler_mutex); 190 std::lock_guard<std::mutex> lock(scheduler_mutex);
189 191
190 const u32 mask = 1U << core; 192 const u32 mask = 1U << core;
191 for (auto& thread : ready_queue) { 193 for (auto* thread : ready_queue) {
192 if ((thread->GetAffinityMask() & mask) != 0 && thread->GetPriority() < maximum_priority) 194 if ((thread->GetAffinityMask() & mask) != 0 && thread->GetPriority() < maximum_priority) {
193 return thread; 195 return thread;
196 }
194 } 197 }
195 return nullptr; 198 return nullptr;
196} 199}