summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/scheduler.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2019-11-15 12:08:50 -0500
committerGravatar GitHub2019-11-15 12:08:50 -0500
commit3e0e4f146b3f2ad7f1935a61141c38cdce87e04f (patch)
tree75f29ce4bb9d84f9d9722b7aa86d71e805cac8cc /src/core/hle/kernel/scheduler.cpp
parentMerge pull request #3113 from lioncash/semi (diff)
parentexternals: Update httplib (diff)
downloadyuzu-3e0e4f146b3f2ad7f1935a61141c38cdce87e04f.tar.gz
yuzu-3e0e4f146b3f2ad7f1935a61141c38cdce87e04f.tar.xz
yuzu-3e0e4f146b3f2ad7f1935a61141c38cdce87e04f.zip
Merge pull request #3091 from lioncash/core-conversion
core: Make most implicit type conversion warnings errors on MSVC
Diffstat (limited to 'src/core/hle/kernel/scheduler.cpp')
-rw-r--r--src/core/hle/kernel/scheduler.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp
index 0e2dbf13e..16e95381b 100644
--- a/src/core/hle/kernel/scheduler.cpp
+++ b/src/core/hle/kernel/scheduler.cpp
@@ -35,12 +35,12 @@ void GlobalScheduler::RemoveThread(const Thread* thread) {
35 thread_list.end()); 35 thread_list.end());
36} 36}
37 37
38void GlobalScheduler::UnloadThread(s32 core) { 38void GlobalScheduler::UnloadThread(std::size_t core) {
39 Scheduler& sched = system.Scheduler(core); 39 Scheduler& sched = system.Scheduler(core);
40 sched.UnloadThread(); 40 sched.UnloadThread();
41} 41}
42 42
43void GlobalScheduler::SelectThread(u32 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) {
46 if (thread == nullptr) { 46 if (thread == nullptr) {
@@ -77,9 +77,9 @@ void GlobalScheduler::SelectThread(u32 core) {
77 // if we got a suggested thread, select it, else do a second pass. 77 // if we got a suggested thread, select it, else do a second pass.
78 if (winner && winner->GetPriority() > 2) { 78 if (winner && winner->GetPriority() > 2) {
79 if (winner->IsRunning()) { 79 if (winner->IsRunning()) {
80 UnloadThread(winner->GetProcessorID()); 80 UnloadThread(static_cast<u32>(winner->GetProcessorID()));
81 } 81 }
82 TransferToCore(winner->GetPriority(), core, winner); 82 TransferToCore(winner->GetPriority(), static_cast<s32>(core), winner);
83 update_thread(winner, sched); 83 update_thread(winner, sched);
84 return; 84 return;
85 } 85 }
@@ -91,9 +91,9 @@ void GlobalScheduler::SelectThread(u32 core) {
91 Thread* thread_on_core = scheduled_queue[src_core].front(); 91 Thread* thread_on_core = scheduled_queue[src_core].front();
92 Thread* to_change = *it; 92 Thread* to_change = *it;
93 if (thread_on_core->IsRunning() || to_change->IsRunning()) { 93 if (thread_on_core->IsRunning() || to_change->IsRunning()) {
94 UnloadThread(src_core); 94 UnloadThread(static_cast<u32>(src_core));
95 } 95 }
96 TransferToCore(thread_on_core->GetPriority(), core, thread_on_core); 96 TransferToCore(thread_on_core->GetPriority(), static_cast<s32>(core), thread_on_core);
97 current_thread = thread_on_core; 97 current_thread = thread_on_core;
98 break; 98 break;
99 } 99 }
@@ -154,9 +154,9 @@ bool GlobalScheduler::YieldThreadAndBalanceLoad(Thread* yielding_thread) {
154 if (winner != nullptr) { 154 if (winner != nullptr) {
155 if (winner != yielding_thread) { 155 if (winner != yielding_thread) {
156 if (winner->IsRunning()) { 156 if (winner->IsRunning()) {
157 UnloadThread(winner->GetProcessorID()); 157 UnloadThread(static_cast<u32>(winner->GetProcessorID()));
158 } 158 }
159 TransferToCore(winner->GetPriority(), core_id, winner); 159 TransferToCore(winner->GetPriority(), s32(core_id), winner);
160 } 160 }
161 } else { 161 } else {
162 winner = next_thread; 162 winner = next_thread;
@@ -196,9 +196,9 @@ bool GlobalScheduler::YieldThreadAndWaitForLoadBalancing(Thread* yielding_thread
196 if (winner != nullptr) { 196 if (winner != nullptr) {
197 if (winner != yielding_thread) { 197 if (winner != yielding_thread) {
198 if (winner->IsRunning()) { 198 if (winner->IsRunning()) {
199 UnloadThread(winner->GetProcessorID()); 199 UnloadThread(static_cast<u32>(winner->GetProcessorID()));
200 } 200 }
201 TransferToCore(winner->GetPriority(), core_id, winner); 201 TransferToCore(winner->GetPriority(), static_cast<s32>(core_id), winner);
202 } 202 }
203 } else { 203 } else {
204 winner = yielding_thread; 204 winner = yielding_thread;
@@ -248,7 +248,7 @@ void GlobalScheduler::PreemptThreads() {
248 248
249 if (winner != nullptr) { 249 if (winner != nullptr) {
250 if (winner->IsRunning()) { 250 if (winner->IsRunning()) {
251 UnloadThread(winner->GetProcessorID()); 251 UnloadThread(static_cast<u32>(winner->GetProcessorID()));
252 } 252 }
253 TransferToCore(winner->GetPriority(), s32(core_id), winner); 253 TransferToCore(winner->GetPriority(), s32(core_id), winner);
254 current_thread = 254 current_thread =
@@ -281,7 +281,7 @@ void GlobalScheduler::PreemptThreads() {
281 281
282 if (winner != nullptr) { 282 if (winner != nullptr) {
283 if (winner->IsRunning()) { 283 if (winner->IsRunning()) {
284 UnloadThread(winner->GetProcessorID()); 284 UnloadThread(static_cast<u32>(winner->GetProcessorID()));
285 } 285 }
286 TransferToCore(winner->GetPriority(), s32(core_id), winner); 286 TransferToCore(winner->GetPriority(), s32(core_id), winner);
287 current_thread = winner; 287 current_thread = winner;
@@ -292,30 +292,30 @@ void GlobalScheduler::PreemptThreads() {
292 } 292 }
293} 293}
294 294
295void GlobalScheduler::Suggest(u32 priority, u32 core, Thread* thread) { 295void GlobalScheduler::Suggest(u32 priority, std::size_t core, Thread* thread) {
296 suggested_queue[core].add(thread, priority); 296 suggested_queue[core].add(thread, priority);
297} 297}
298 298
299void GlobalScheduler::Unsuggest(u32 priority, u32 core, Thread* thread) { 299void GlobalScheduler::Unsuggest(u32 priority, std::size_t core, Thread* thread) {
300 suggested_queue[core].remove(thread, priority); 300 suggested_queue[core].remove(thread, priority);
301} 301}
302 302
303void GlobalScheduler::Schedule(u32 priority, u32 core, Thread* thread) { 303void GlobalScheduler::Schedule(u32 priority, std::size_t core, Thread* thread) {
304 ASSERT_MSG(thread->GetProcessorID() == s32(core), "Thread must be assigned to this core."); 304 ASSERT_MSG(thread->GetProcessorID() == s32(core), "Thread must be assigned to this core.");
305 scheduled_queue[core].add(thread, priority); 305 scheduled_queue[core].add(thread, priority);
306} 306}
307 307
308void GlobalScheduler::SchedulePrepend(u32 priority, u32 core, Thread* thread) { 308void GlobalScheduler::SchedulePrepend(u32 priority, std::size_t core, Thread* thread) {
309 ASSERT_MSG(thread->GetProcessorID() == s32(core), "Thread must be assigned to this core."); 309 ASSERT_MSG(thread->GetProcessorID() == s32(core), "Thread must be assigned to this core.");
310 scheduled_queue[core].add(thread, priority, false); 310 scheduled_queue[core].add(thread, priority, false);
311} 311}
312 312
313void GlobalScheduler::Reschedule(u32 priority, u32 core, Thread* thread) { 313void GlobalScheduler::Reschedule(u32 priority, std::size_t core, Thread* thread) {
314 scheduled_queue[core].remove(thread, priority); 314 scheduled_queue[core].remove(thread, priority);
315 scheduled_queue[core].add(thread, priority); 315 scheduled_queue[core].add(thread, priority);
316} 316}
317 317
318void GlobalScheduler::Unschedule(u32 priority, u32 core, Thread* thread) { 318void GlobalScheduler::Unschedule(u32 priority, std::size_t core, Thread* thread) {
319 scheduled_queue[core].remove(thread, priority); 319 scheduled_queue[core].remove(thread, priority);
320} 320}
321 321
@@ -327,14 +327,14 @@ void GlobalScheduler::TransferToCore(u32 priority, s32 destination_core, Thread*
327 } 327 }
328 thread->SetProcessorID(destination_core); 328 thread->SetProcessorID(destination_core);
329 if (source_core >= 0) { 329 if (source_core >= 0) {
330 Unschedule(priority, source_core, thread); 330 Unschedule(priority, static_cast<u32>(source_core), thread);
331 } 331 }
332 if (destination_core >= 0) { 332 if (destination_core >= 0) {
333 Unsuggest(priority, destination_core, thread); 333 Unsuggest(priority, static_cast<u32>(destination_core), thread);
334 Schedule(priority, destination_core, thread); 334 Schedule(priority, static_cast<u32>(destination_core), thread);
335 } 335 }
336 if (source_core >= 0) { 336 if (source_core >= 0) {
337 Suggest(priority, source_core, thread); 337 Suggest(priority, static_cast<u32>(source_core), thread);
338 } 338 }
339} 339}
340 340
@@ -357,7 +357,7 @@ void GlobalScheduler::Shutdown() {
357 thread_list.clear(); 357 thread_list.clear();
358} 358}
359 359
360Scheduler::Scheduler(Core::System& system, Core::ARM_Interface& cpu_core, u32 core_id) 360Scheduler::Scheduler(Core::System& system, Core::ARM_Interface& cpu_core, std::size_t core_id)
361 : system(system), cpu_core(cpu_core), core_id(core_id) {} 361 : system(system), cpu_core(cpu_core), core_id(core_id) {}
362 362
363Scheduler::~Scheduler() = default; 363Scheduler::~Scheduler() = default;