Kernel: Preempt Single core on redudant yields.
This commit is contained in:
parent
a439cdf22e
commit
d494b074e8
6 changed files with 42 additions and 21 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue