diff options
| author | 2019-03-30 19:59:10 -0400 | |
|---|---|---|
| committer | 2019-03-30 19:59:10 -0400 | |
| commit | ba3d95e5509585daadc45a466fcf0ee18a2d8e29 (patch) | |
| tree | d0f667d419f516bd8fe12da39f8d10ac39664392 /src/core/hle/kernel/scheduler.cpp | |
| parent | Merge pull request #2307 from lioncash/regnames (diff) | |
| parent | kernel/scheduler: Remove unused parameter to AddThread() (diff) | |
| download | yuzu-ba3d95e5509585daadc45a466fcf0ee18a2d8e29.tar.gz yuzu-ba3d95e5509585daadc45a466fcf0ee18a2d8e29.tar.xz yuzu-ba3d95e5509585daadc45a466fcf0ee18a2d8e29.zip | |
Merge pull request #2308 from lioncash/deduction
kernel/scheduler: Minor tidying up
Diffstat (limited to 'src/core/hle/kernel/scheduler.cpp')
| -rw-r--r-- | src/core/hle/kernel/scheduler.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp index 6d0f13ecf..ac501bf7f 100644 --- a/src/core/hle/kernel/scheduler.cpp +++ b/src/core/hle/kernel/scheduler.cpp | |||
| @@ -29,7 +29,7 @@ Scheduler::~Scheduler() { | |||
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | bool Scheduler::HaveReadyThreads() const { | 31 | bool Scheduler::HaveReadyThreads() const { |
| 32 | std::lock_guard<std::mutex> lock(scheduler_mutex); | 32 | std::lock_guard lock{scheduler_mutex}; |
| 33 | return !ready_queue.empty(); | 33 | return !ready_queue.empty(); |
| 34 | } | 34 | } |
| 35 | 35 | ||
| @@ -132,7 +132,7 @@ void Scheduler::UpdateLastContextSwitchTime(Thread* thread, Process* process) { | |||
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | void Scheduler::Reschedule() { | 134 | void Scheduler::Reschedule() { |
| 135 | std::lock_guard<std::mutex> lock(scheduler_mutex); | 135 | std::lock_guard lock{scheduler_mutex}; |
| 136 | 136 | ||
| 137 | Thread* cur = GetCurrentThread(); | 137 | Thread* cur = GetCurrentThread(); |
| 138 | Thread* next = PopNextReadyThread(); | 138 | Thread* next = PopNextReadyThread(); |
| @@ -148,35 +148,35 @@ void Scheduler::Reschedule() { | |||
| 148 | SwitchContext(next); | 148 | SwitchContext(next); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | void Scheduler::AddThread(SharedPtr<Thread> thread, u32 priority) { | 151 | void Scheduler::AddThread(SharedPtr<Thread> thread) { |
| 152 | std::lock_guard<std::mutex> lock(scheduler_mutex); | 152 | std::lock_guard lock{scheduler_mutex}; |
| 153 | 153 | ||
| 154 | thread_list.push_back(std::move(thread)); | 154 | thread_list.push_back(std::move(thread)); |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | void Scheduler::RemoveThread(Thread* thread) { | 157 | void Scheduler::RemoveThread(Thread* thread) { |
| 158 | std::lock_guard<std::mutex> lock(scheduler_mutex); | 158 | std::lock_guard lock{scheduler_mutex}; |
| 159 | 159 | ||
| 160 | thread_list.erase(std::remove(thread_list.begin(), thread_list.end(), thread), | 160 | thread_list.erase(std::remove(thread_list.begin(), thread_list.end(), thread), |
| 161 | thread_list.end()); | 161 | thread_list.end()); |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | void Scheduler::ScheduleThread(Thread* thread, u32 priority) { | 164 | void Scheduler::ScheduleThread(Thread* thread, u32 priority) { |
| 165 | std::lock_guard<std::mutex> lock(scheduler_mutex); | 165 | std::lock_guard lock{scheduler_mutex}; |
| 166 | 166 | ||
| 167 | ASSERT(thread->GetStatus() == ThreadStatus::Ready); | 167 | ASSERT(thread->GetStatus() == ThreadStatus::Ready); |
| 168 | ready_queue.add(thread, priority); | 168 | ready_queue.add(thread, priority); |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | void Scheduler::UnscheduleThread(Thread* thread, u32 priority) { | 171 | void Scheduler::UnscheduleThread(Thread* thread, u32 priority) { |
| 172 | std::lock_guard<std::mutex> lock(scheduler_mutex); | 172 | std::lock_guard lock{scheduler_mutex}; |
| 173 | 173 | ||
| 174 | ASSERT(thread->GetStatus() == ThreadStatus::Ready); | 174 | ASSERT(thread->GetStatus() == ThreadStatus::Ready); |
| 175 | ready_queue.remove(thread, priority); | 175 | ready_queue.remove(thread, priority); |
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | void Scheduler::SetThreadPriority(Thread* thread, u32 priority) { | 178 | void Scheduler::SetThreadPriority(Thread* thread, u32 priority) { |
| 179 | std::lock_guard<std::mutex> lock(scheduler_mutex); | 179 | std::lock_guard lock{scheduler_mutex}; |
| 180 | if (thread->GetPriority() == priority) { | 180 | if (thread->GetPriority() == priority) { |
| 181 | return; | 181 | return; |
| 182 | } | 182 | } |
| @@ -187,7 +187,7 @@ void Scheduler::SetThreadPriority(Thread* thread, u32 priority) { | |||
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | Thread* Scheduler::GetNextSuggestedThread(u32 core, u32 maximum_priority) const { | 189 | Thread* Scheduler::GetNextSuggestedThread(u32 core, u32 maximum_priority) const { |
| 190 | std::lock_guard<std::mutex> lock(scheduler_mutex); | 190 | std::lock_guard lock{scheduler_mutex}; |
| 191 | 191 | ||
| 192 | const u32 mask = 1U << core; | 192 | const u32 mask = 1U << core; |
| 193 | for (auto* thread : ready_queue) { | 193 | for (auto* thread : ready_queue) { |