mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-22 09:09:18 +01:00
coreinit: Add reschedule special case to avoid a deadlock
Fixes Just Dance 2019 locking up on boot
This commit is contained in:
parent
7d6d417354
commit
065fb7eb58
@ -763,6 +763,11 @@ namespace coreinit
|
|||||||
uint32 coreIndex = OSGetCoreId();
|
uint32 coreIndex = OSGetCoreId();
|
||||||
if (!newThread->context.hasCoreAffinitySet(coreIndex))
|
if (!newThread->context.hasCoreAffinitySet(coreIndex))
|
||||||
return false;
|
return false;
|
||||||
|
// special case: if current and new thread are running only on the same core then reschedule even if priority is equal
|
||||||
|
// this resolves a deadlock in Just Dance 2019 where one thread would always reacquire the same mutex within it's timeslice, blocking another thread on the same core from acquiring it
|
||||||
|
if ((1<<coreIndex) == newThread->context.affinity && currentThread->context.affinity == newThread->context.affinity && currentThread->effectivePriority == newThread->effectivePriority)
|
||||||
|
return true;
|
||||||
|
// otherwise reschedule if new thread has higher priority
|
||||||
return newThread->effectivePriority < currentThread->effectivePriority;
|
return newThread->effectivePriority < currentThread->effectivePriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user