hle(host_posix): implement WaitOnAddress, WakeByAddressSingle, and WakeByAddressAll #555
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-28T03:48:34Z.
Problem
docs/native-host.mdlistsWaitOnAddressandWakeByAddress*(api-ms-win-core-synch-l1-2-0.dll,kernelbase.dll,kernel32.dll) among the core Win32 synchronisation primitives for title and C++ runtime code, andvictory_platform::syncalready provideswait_on_address/wake_one/wake_allfor internal locks.However,
crates/victory-hle/src/host_posix/sync.rsdoes not implement or exportWaitOnAddress,WakeByAddressSingle, orWakeByAddressAllinsync::lookup. On macOS:GetProcAddressforWaitOnAddress/WakeByAddressSingle/WakeByAddressAllfails withERROR_PROC_NOT_FOUND.--unimplemented zeroreturn0immediately without waiting and without settingERROR_TIMEOUT, causing any caller synchronizing viaWaitOnAddressto either proceed prematurely or busy-spin.Note that Win32
WaitOnAddresssupportsAddressSizevalues of1,2,4, and8bytes (aligned or unaligned) whileWakeByAddressSingle/WakeByAddressAlltake only the targetAddresswithout a size argument (whereas Darwin'sos_sync_wake_by_address_*requiressizein{4, 8}matching the wait call and aligned tosize).Proposed Fix
WaitOnAddress,WakeByAddressSingle, andWakeByAddressAllincrates/victory-hle/src/host_posix/sync.rsusing striped wait queues keyed by exactAddresson top ofvictory_platform::sync::{wait_on_address, wake_one}:AddressSizein{1, 2, 4, 8}(usingSeqCstatomic loads when naturally aligned and unaligned reads otherwise); reject null pointers or invalidAddressSizewithERROR_INVALID_PARAMETER.ms == 0, finite millisecond timeouts (ERROR_TIMEOUT), andINFINITE.WaitOnAddress,WakeByAddressSingle, andWakeByAddressAllinsync::lookup.WakeByAddressSinglevsWakeByAddressAllisolation, timeouts, and invalid arguments.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-28T03:48:35Z.
/claim
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T03:48:46Z.
Claimed by @Sheffy007. Open a draft pull request with
Refs #555in its description within 24 hours, or the claim expires.