mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-10 13:01:45 +12:00
More threading fixes
This commit is contained in:
parent
7047bf6ec8
commit
65de2637ae
3 changed files with 24 additions and 15 deletions
|
@ -35,22 +35,15 @@ bool Kernel::signalEvent(Handle handle) {
|
|||
|
||||
// Check if there's any thread waiting on this event
|
||||
if (event->waitlist != 0) {
|
||||
// One-shot events get cleared once they are acquired by some thread and only wake up 1 thread at a time
|
||||
wakeupAllThreads(event->waitlist, handle);
|
||||
event->waitlist = 0; // No threads waiting;
|
||||
|
||||
if (event->resetType == ResetType::OneShot) {
|
||||
int index = wakeupOneThread(event->waitlist, handle); // Wake up one thread with the highest priority
|
||||
event->waitlist ^= (1ull << index); // Remove thread from waitlist
|
||||
event->fired = false;
|
||||
} else {
|
||||
wakeupAllThreads(event->waitlist, handle);
|
||||
event->waitlist = 0; // No threads waiting;
|
||||
}
|
||||
|
||||
// We must reschedule our threads if we signalled one. Some games such as FE: Awakening rely on this
|
||||
// If this does not happen, we can have phenomena such as a thread waiting up a higher priority thread,
|
||||
// and the higher priority thread just never running
|
||||
requireReschedule();
|
||||
}
|
||||
|
||||
|
||||
rescheduleThreads();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue