mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-21 11:05:46 +00:00
Scheduler: Correct yielding interaction with SetThreadActivity.
This commit is contained in:
parent
b121009e03
commit
d03d00c9c2
1 changed files with 15 additions and 0 deletions
|
@ -144,6 +144,11 @@ u32 GlobalScheduler::SelectThreads() {
|
||||||
bool GlobalScheduler::YieldThread(Thread* yielding_thread) {
|
bool GlobalScheduler::YieldThread(Thread* yielding_thread) {
|
||||||
ASSERT(is_locked);
|
ASSERT(is_locked);
|
||||||
// Note: caller should use critical section, etc.
|
// Note: caller should use critical section, etc.
|
||||||
|
if (!yielding_thread->IsRunnable()) {
|
||||||
|
// Normally this case shouldn't happen except for SetThreadActivity.
|
||||||
|
is_reselection_pending.store(true, std::memory_order_release);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
const u32 core_id = static_cast<u32>(yielding_thread->GetProcessorID());
|
const u32 core_id = static_cast<u32>(yielding_thread->GetProcessorID());
|
||||||
const u32 priority = yielding_thread->GetPriority();
|
const u32 priority = yielding_thread->GetPriority();
|
||||||
|
|
||||||
|
@ -161,6 +166,11 @@ bool GlobalScheduler::YieldThreadAndBalanceLoad(Thread* yielding_thread) {
|
||||||
ASSERT(is_locked);
|
ASSERT(is_locked);
|
||||||
// Note: caller should check if !thread.IsSchedulerOperationRedundant and use critical section,
|
// Note: caller should check if !thread.IsSchedulerOperationRedundant and use critical section,
|
||||||
// etc.
|
// etc.
|
||||||
|
if (!yielding_thread->IsRunnable()) {
|
||||||
|
// Normally this case shouldn't happen except for SetThreadActivity.
|
||||||
|
is_reselection_pending.store(true, std::memory_order_release);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
const u32 core_id = static_cast<u32>(yielding_thread->GetProcessorID());
|
const u32 core_id = static_cast<u32>(yielding_thread->GetProcessorID());
|
||||||
const u32 priority = yielding_thread->GetPriority();
|
const u32 priority = yielding_thread->GetPriority();
|
||||||
|
|
||||||
|
@ -212,6 +222,11 @@ bool GlobalScheduler::YieldThreadAndWaitForLoadBalancing(Thread* yielding_thread
|
||||||
ASSERT(is_locked);
|
ASSERT(is_locked);
|
||||||
// Note: caller should check if !thread.IsSchedulerOperationRedundant and use critical section,
|
// Note: caller should check if !thread.IsSchedulerOperationRedundant and use critical section,
|
||||||
// etc.
|
// etc.
|
||||||
|
if (!yielding_thread->IsRunnable()) {
|
||||||
|
// Normally this case shouldn't happen except for SetThreadActivity.
|
||||||
|
is_reselection_pending.store(true, std::memory_order_release);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Thread* winner = nullptr;
|
Thread* winner = nullptr;
|
||||||
const u32 core_id = static_cast<u32>(yielding_thread->GetProcessorID());
|
const u32 core_id = static_cast<u32>(yielding_thread->GetProcessorID());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue