diff options
author | bunnei <bunneidev@gmail.com> | 2019-03-31 00:59:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-31 00:59:10 +0100 |
commit | ba3d95e5509585daadc45a466fcf0ee18a2d8e29 (patch) | |
tree | d0f667d419f516bd8fe12da39f8d10ac39664392 /src/core | |
parent | Merge pull request #2307 from lioncash/regnames (diff) | |
parent | kernel/scheduler: Remove unused parameter to AddThread() (diff) | |
download | yuzu-ba3d95e5509585daadc45a466fcf0ee18a2d8e29.tar yuzu-ba3d95e5509585daadc45a466fcf0ee18a2d8e29.tar.gz yuzu-ba3d95e5509585daadc45a466fcf0ee18a2d8e29.tar.bz2 yuzu-ba3d95e5509585daadc45a466fcf0ee18a2d8e29.tar.lz yuzu-ba3d95e5509585daadc45a466fcf0ee18a2d8e29.tar.xz yuzu-ba3d95e5509585daadc45a466fcf0ee18a2d8e29.tar.zst yuzu-ba3d95e5509585daadc45a466fcf0ee18a2d8e29.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/hle/kernel/scheduler.cpp | 18 | ||||
-rw-r--r-- | src/core/hle/kernel/scheduler.h | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/thread.cpp | 4 |
3 files changed, 12 insertions, 12 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() { } bool Scheduler::HaveReadyThreads() const { - std::lock_guard<std::mutex> lock(scheduler_mutex); + std::lock_guard lock{scheduler_mutex}; return !ready_queue.empty(); } @@ -132,7 +132,7 @@ void Scheduler::UpdateLastContextSwitchTime(Thread* thread, Process* process) { } void Scheduler::Reschedule() { - std::lock_guard<std::mutex> lock(scheduler_mutex); + std::lock_guard lock{scheduler_mutex}; Thread* cur = GetCurrentThread(); Thread* next = PopNextReadyThread(); @@ -148,35 +148,35 @@ void Scheduler::Reschedule() { SwitchContext(next); } -void Scheduler::AddThread(SharedPtr<Thread> thread, u32 priority) { - std::lock_guard<std::mutex> lock(scheduler_mutex); +void Scheduler::AddThread(SharedPtr<Thread> thread) { + std::lock_guard lock{scheduler_mutex}; thread_list.push_back(std::move(thread)); } void Scheduler::RemoveThread(Thread* thread) { - std::lock_guard<std::mutex> lock(scheduler_mutex); + std::lock_guard lock{scheduler_mutex}; thread_list.erase(std::remove(thread_list.begin(), thread_list.end(), thread), thread_list.end()); } void Scheduler::ScheduleThread(Thread* thread, u32 priority) { - std::lock_guard<std::mutex> lock(scheduler_mutex); + std::lock_guard lock{scheduler_mutex}; ASSERT(thread->GetStatus() == ThreadStatus::Ready); ready_queue.add(thread, priority); } void Scheduler::UnscheduleThread(Thread* thread, u32 priority) { - std::lock_guard<std::mutex> lock(scheduler_mutex); + std::lock_guard lock{scheduler_mutex}; ASSERT(thread->GetStatus() == ThreadStatus::Ready); ready_queue.remove(thread, priority); } void Scheduler::SetThreadPriority(Thread* thread, u32 priority) { - std::lock_guard<std::mutex> lock(scheduler_mutex); + std::lock_guard lock{scheduler_mutex}; if (thread->GetPriority() == priority) { return; } @@ -187,7 +187,7 @@ void Scheduler::SetThreadPriority(Thread* thread, u32 priority) { } Thread* Scheduler::GetNextSuggestedThread(u32 core, u32 maximum_priority) const { - std::lock_guard<std::mutex> lock(scheduler_mutex); + std::lock_guard lock{scheduler_mutex}; const u32 mask = 1U << core; for (auto* thread : ready_queue) { diff --git a/src/core/hle/kernel/scheduler.h b/src/core/hle/kernel/scheduler.h index 44baeb713..b29bf7be8 100644 --- a/src/core/hle/kernel/scheduler.h +++ b/src/core/hle/kernel/scheduler.h @@ -38,7 +38,7 @@ public: u64 GetLastContextSwitchTicks() const; /// Adds a new thread to the scheduler - void AddThread(SharedPtr<Thread> thread, u32 priority); + void AddThread(SharedPtr<Thread> thread); /// Removes a thread from the scheduler void RemoveThread(Thread* thread); diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index e5853c46f..fa3ac3abc 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -199,7 +199,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(KernelCore& kernel, std::string name thread->callback_handle = kernel.ThreadWakeupCallbackHandleTable().Create(thread).Unwrap(); thread->owner_process = &owner_process; thread->scheduler = &system.Scheduler(processor_id); - thread->scheduler->AddThread(thread, priority); + thread->scheduler->AddThread(thread); thread->tls_address = thread->owner_process->MarkNextAvailableTLSSlotAsUsed(*thread); // TODO(peachum): move to ScheduleThread() when scheduler is added so selected core is used @@ -352,7 +352,7 @@ void Thread::ChangeScheduler() { if (*new_processor_id != processor_id) { // Remove thread from previous core's scheduler scheduler->RemoveThread(this); - next_scheduler.AddThread(this, current_priority); + next_scheduler.AddThread(this); } processor_id = *new_processor_id; |