diff options
| author | Zach Hilman <zachhilman@gmail.com> | 2018-11-22 00:33:53 -0500 |
|---|---|---|
| committer | Zach Hilman <zachhilman@gmail.com> | 2018-11-22 00:33:53 -0500 |
| commit | 820d81b9a5392951c18daa5a47d6c0ffd28baa9b (patch) | |
| tree | dab20f1ff49ab76cdcd511e189799f4d6e40677e /src/core/hle/kernel/svc.cpp | |
| parent | 409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a (diff) | |
scheduler: Add explanations for YieldWith and WithoutLoadBalancing
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 467575c93..205706033 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -965,16 +965,23 @@ static void SleepThread(s64 nanoseconds) { if (!Core::System::GetInstance().CurrentScheduler().HaveReadyThreads()) return; + enum class SleepType : s64 { + YieldWithoutLoadBalancing = 0, + YieldWithLoadBalancing = 1, + YieldAndWaitForLoadBalancing = 2, + }; + if (nanoseconds <= 0) { - switch (nanoseconds) { - case 0: - GetCurrentThread()->YieldNormal(); + auto& scheduler{Core::System::GetInstance().CurrentScheduler()}; + switch (static_cast<SleepType>(nanoseconds)) { + case SleepType::YieldWithoutLoadBalancing: + scheduler.YieldWithoutLoadBalancing(GetCurrentThread()); break; - case -1: - GetCurrentThread()->YieldWithLoadBalancing(); + case SleepType::YieldWithLoadBalancing: + scheduler.YieldWithLoadBalancing(GetCurrentThread()); break; - case -2: - GetCurrentThread()->YieldAndWaitForLoadBalancing(); + case SleepType::YieldAndWaitForLoadBalancing: + scheduler.YieldAndWaitForLoadBalancing(GetCurrentThread()); break; default: UNREACHABLE_MSG( |
