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.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp
index 1f4abfbe8..f7e25cbf5 100644
--- a/src/core/hle/kernel/scheduler.cpp
+++ b/src/core/hle/kernel/scheduler.cpp
@@ -34,7 +34,7 @@ Thread* Scheduler::PopNextReadyThread() {
34 Thread* next = nullptr; 34 Thread* next = nullptr;
35 Thread* thread = GetCurrentThread(); 35 Thread* thread = GetCurrentThread();
36 36
37 if (thread && thread->status == THREADSTATUS_RUNNING) { 37 if (thread && thread->status == ThreadStatus::Running) {
38 // We have to do better than the current thread. 38 // We have to do better than the current thread.
39 // This call returns null when that's not possible. 39 // This call returns null when that's not possible.
40 next = ready_queue.pop_first_better(thread->current_priority); 40 next = ready_queue.pop_first_better(thread->current_priority);
@@ -57,17 +57,17 @@ void Scheduler::SwitchContext(Thread* new_thread) {
57 previous_thread->last_running_ticks = CoreTiming::GetTicks(); 57 previous_thread->last_running_ticks = CoreTiming::GetTicks();
58 cpu_core->SaveContext(previous_thread->context); 58 cpu_core->SaveContext(previous_thread->context);
59 59
60 if (previous_thread->status == THREADSTATUS_RUNNING) { 60 if (previous_thread->status == ThreadStatus::Running) {
61 // This is only the case when a reschedule is triggered without the current thread 61 // This is only the case when a reschedule is triggered without the current thread
62 // yielding execution (i.e. an event triggered, system core time-sliced, etc) 62 // yielding execution (i.e. an event triggered, system core time-sliced, etc)
63 ready_queue.push_front(previous_thread->current_priority, previous_thread); 63 ready_queue.push_front(previous_thread->current_priority, previous_thread);
64 previous_thread->status = THREADSTATUS_READY; 64 previous_thread->status = ThreadStatus::Ready;
65 } 65 }
66 } 66 }
67 67
68 // Load context of new thread 68 // Load context of new thread
69 if (new_thread) { 69 if (new_thread) {
70 ASSERT_MSG(new_thread->status == THREADSTATUS_READY, 70 ASSERT_MSG(new_thread->status == ThreadStatus::Ready,
71 "Thread must be ready to become running."); 71 "Thread must be ready to become running.");
72 72
73 // Cancel any outstanding wakeup events for this thread 73 // Cancel any outstanding wakeup events for this thread
@@ -78,7 +78,7 @@ void Scheduler::SwitchContext(Thread* new_thread) {
78 current_thread = new_thread; 78 current_thread = new_thread;
79 79
80 ready_queue.remove(new_thread->current_priority, new_thread); 80 ready_queue.remove(new_thread->current_priority, new_thread);
81 new_thread->status = THREADSTATUS_RUNNING; 81 new_thread->status = ThreadStatus::Running;
82 82
83 if (previous_process != current_thread->owner_process) { 83 if (previous_process != current_thread->owner_process) {
84 Core::CurrentProcess() = current_thread->owner_process; 84 Core::CurrentProcess() = current_thread->owner_process;
@@ -129,14 +129,14 @@ void Scheduler::RemoveThread(Thread* thread) {
129void Scheduler::ScheduleThread(Thread* thread, u32 priority) { 129void Scheduler::ScheduleThread(Thread* thread, u32 priority) {
130 std::lock_guard<std::mutex> lock(scheduler_mutex); 130 std::lock_guard<std::mutex> lock(scheduler_mutex);
131 131
132 ASSERT(thread->status == THREADSTATUS_READY); 132 ASSERT(thread->status == ThreadStatus::Ready);
133 ready_queue.push_back(priority, thread); 133 ready_queue.push_back(priority, thread);
134} 134}
135 135
136void Scheduler::UnscheduleThread(Thread* thread, u32 priority) { 136void Scheduler::UnscheduleThread(Thread* thread, u32 priority) {
137 std::lock_guard<std::mutex> lock(scheduler_mutex); 137 std::lock_guard<std::mutex> lock(scheduler_mutex);
138 138
139 ASSERT(thread->status == THREADSTATUS_READY); 139 ASSERT(thread->status == ThreadStatus::Ready);
140 ready_queue.remove(priority, thread); 140 ready_queue.remove(priority, thread);
141} 141}
142 142
@@ -144,7 +144,7 @@ void Scheduler::SetThreadPriority(Thread* thread, u32 priority) {
144 std::lock_guard<std::mutex> lock(scheduler_mutex); 144 std::lock_guard<std::mutex> lock(scheduler_mutex);
145 145
146 // If thread was ready, adjust queues 146 // If thread was ready, adjust queues
147 if (thread->status == THREADSTATUS_READY) 147 if (thread->status == ThreadStatus::Ready)
148 ready_queue.move(thread, thread->current_priority, priority); 148 ready_queue.move(thread, thread->current_priority, priority);
149 else 149 else
150 ready_queue.prepare(priority); 150 ready_queue.prepare(priority);