summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/scheduler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel/scheduler.cpp')
-rw-r--r--src/core/hle/kernel/scheduler.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp
index 16e95381b..3f5192087 100644
--- a/src/core/hle/kernel/scheduler.cpp
+++ b/src/core/hle/kernel/scheduler.cpp
@@ -26,11 +26,11 @@ GlobalScheduler::GlobalScheduler(Core::System& system) : system{system} {}
26 26
27GlobalScheduler::~GlobalScheduler() = default; 27GlobalScheduler::~GlobalScheduler() = default;
28 28
29void GlobalScheduler::AddThread(SharedPtr<Thread> thread) { 29void GlobalScheduler::AddThread(std::shared_ptr<Thread> thread) {
30 thread_list.push_back(std::move(thread)); 30 thread_list.push_back(std::move(thread));
31} 31}
32 32
33void GlobalScheduler::RemoveThread(const Thread* thread) { 33void GlobalScheduler::RemoveThread(std::shared_ptr<Thread> thread) {
34 thread_list.erase(std::remove(thread_list.begin(), thread_list.end(), thread), 34 thread_list.erase(std::remove(thread_list.begin(), thread_list.end(), thread),
35 thread_list.end()); 35 thread_list.end());
36} 36}
@@ -42,11 +42,11 @@ void GlobalScheduler::UnloadThread(std::size_t core) {
42 42
43void GlobalScheduler::SelectThread(std::size_t core) { 43void GlobalScheduler::SelectThread(std::size_t core) {
44 const auto update_thread = [](Thread* thread, Scheduler& sched) { 44 const auto update_thread = [](Thread* thread, Scheduler& sched) {
45 if (thread != sched.selected_thread) { 45 if (thread != sched.selected_thread.get()) {
46 if (thread == nullptr) { 46 if (thread == nullptr) {
47 ++sched.idle_selection_count; 47 ++sched.idle_selection_count;
48 } 48 }
49 sched.selected_thread = thread; 49 sched.selected_thread = SharedFrom(thread);
50 } 50 }
51 sched.is_context_switch_pending = sched.selected_thread != sched.current_thread; 51 sched.is_context_switch_pending = sched.selected_thread != sched.current_thread;
52 std::atomic_thread_fence(std::memory_order_seq_cst); 52 std::atomic_thread_fence(std::memory_order_seq_cst);
@@ -446,7 +446,7 @@ void Scheduler::SwitchContext() {
446 446
447 // Cancel any outstanding wakeup events for this thread 447 // Cancel any outstanding wakeup events for this thread
448 new_thread->CancelWakeupTimer(); 448 new_thread->CancelWakeupTimer();
449 current_thread = new_thread; 449 current_thread = SharedFrom(new_thread);
450 new_thread->SetStatus(ThreadStatus::Running); 450 new_thread->SetStatus(ThreadStatus::Running);
451 new_thread->SetIsRunning(true); 451 new_thread->SetIsRunning(true);
452 452