hle(posix): fix WaitForMultipleObjects rollback wakes, SetWaitableTimer rearm races, and WaitForThreadpoolWorkCallbacks cancel #490
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-27T22:08:03Z.
Summary
Three Win32 synchronisation and callback-cancellation bugs in
crates/victory-hle/src/host_posixcan wake threads prematurely, strand concurrent multi-object waiters, or run cancelled work callbacks after their caller freed their context (Refs #456):Waitable::give_back(crates/victory-hle/src/host_posix.rs:643-653):WaitForMultipleObjects(..., wait_all = 1)rolls back a partial take,give_backrestores auto-resetEvent,Semaphore, andMutexobjects without callingsync::signalled(), leaving any concurrentWaitForMultipleObjects(..., wait_all = 0)waiter asleep onEPOCH.give_backalso callse.set()unconditionally on manual-reset events (whichtry_takenever consumed), overwriting a concurrentResetEvent.SetWaitableTimer/CancelWaitableTimer(crates/victory-hle/src/host_posix/system.rs:1363-1463):while live()(generationcheck) andtimer.event.set(): a preempted worker from a supersededSetWaitableTimerorCancelWaitableTimercan calltimer.event.set()after a newSetWaitableTimerincrementedgenerationand calledtimer.event.reset(), signalling the re-armed timer early before its newduetime elapses.SetWaitableTimercall also spawns a fresh OS thread that stays blocked instd::thread::sleepacross cancel, re-arm, andCloseHandle.WaitForThreadpoolWorkCallbacks(crates/victory-hle/src/host_posix/system.rs:1765-1768):_cancel(fCancelPendingCallbacks), passingfalseinstead ofcancel != 0toPoolObject::wait_idle(unlikeWaitForThreadpoolTimerCallbacksright below it), so pendingSubmitThreadpoolWorkcallbacks still run afterWaitForThreadpoolWorkCallbacks(work, 1)returns.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-27T22:08:04Z.
/claim
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-27T22:08:15Z.
Claimed by @Sheffy007. Open a draft pull request with
Refs #490in its description within 24 hours, or the claim expires.