diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-03-10 13:13:39 -0400 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-06-27 11:35:45 -0400 |
commit | d494b074e8afd3aff7b65afc7b977496be06ccc9 (patch) | |
tree | 002cc29d32a9b1e44e61fb1aae122715556b36c5 /src/core/hle/kernel/thread.cpp | |
parent | a439cdf22ea50f0e39cb51f6dff15fee3b495d16 (diff) |
Kernel: Preempt Single core on redudant yields.
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
-rw-r--r-- | src/core/hle/kernel/thread.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index fc6c0bc857..1c32552b12 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -435,28 +435,31 @@ ResultCode Thread::Sleep(s64 nanoseconds) { return RESULT_SUCCESS; } -ResultCode Thread::YieldSimple() { +std::pair<ResultCode, bool> Thread::YieldSimple() { + bool is_redundant = false; { SchedulerLock lock(kernel); - kernel.GlobalScheduler().YieldThread(this); + is_redundant = kernel.GlobalScheduler().YieldThread(this); } - return RESULT_SUCCESS; + return {RESULT_SUCCESS, is_redundant}; } -ResultCode Thread::YieldAndBalanceLoad() { +std::pair<ResultCode, bool> Thread::YieldAndBalanceLoad() { + bool is_redundant = false; { SchedulerLock lock(kernel); - kernel.GlobalScheduler().YieldThreadAndBalanceLoad(this); + is_redundant = kernel.GlobalScheduler().YieldThreadAndBalanceLoad(this); } - return RESULT_SUCCESS; + return {RESULT_SUCCESS, is_redundant}; } -ResultCode Thread::YieldAndWaitForLoadBalancing() { +std::pair<ResultCode, bool> Thread::YieldAndWaitForLoadBalancing() { + bool is_redundant = false; { SchedulerLock lock(kernel); - kernel.GlobalScheduler().YieldThreadAndWaitForLoadBalancing(this); + is_redundant = kernel.GlobalScheduler().YieldThreadAndWaitForLoadBalancing(this); } - return RESULT_SUCCESS; + return {RESULT_SUCCESS, is_redundant}; } void Thread::AddSchedulingFlag(ThreadSchedFlags flag) { |