hle(host_posix): implement DuplicateHandle, InitOnce*, FLS destructors, and pooled 8 MiB workers #564
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!564
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-560"
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?
@Sheffy007 on GitHub · 2026-11-28 04:48 UTC · original
Sheffy007:feat/host-posix-threads-initonce-fls→main· +806 −76 · 3 files · 1 commits · openCloses #563
Refs #460, #525
cc @Olima34
Summary
DuplicateHandle,OpenThread,GetThreadId, andExitThread(host_posix.rs,host_posix/system.rs):DuplicateHandle(includingDUPLICATE_CLOSE_SOURCE,DUPLICATE_SAME_ACCESS, and pseudo-handlesGetCurrentProcess()/GetCurrentThread()),GetThreadId,ExitThread(vianative::exit_title_thread), andOpenThreadover trackedThreadObjectrecords (current_thread_objectsynthesizes a live record fortitle-mainor host callback threads when duplicated or opened by ID).InitOnceInitialize,InitOnceBeginInitialize, andInitOnceComplete(host_posix/system.rs):INIT_ONCE(WaitOnAddress/WakeByAddressAllinstead of200 µssleeps),INIT_ONCE_CHECK_ONLY,INIT_ONCE_INIT_FAILEDretries, andINIT_ONCE_ASYNCalongsideInitOnceExecuteOnce, and exports them acrosskernel32/kernelbase/api-ms-win-core-*.FlsAllocdestructor callbacks (PFLS_CALLBACK_FUNCTION) (host_posix/system.rs,docs/native-host.md):FlsFreeclears active slots across all live threads and invokeslpCallback(value)for non-null entries, and exiting threads runfls_thread_exit()before signaling their completion event (with a TLSDropfallback for plain host threads).SubmitThreadpoolWork/SetThreadpoolTimer):SubmitThreadpoolWorkitems on a reusable worker pool spawned withMIN_STACK(8 MiB) instead of spawning a short-lived 2 MiBstd::thread::spawnper submission, and spawnsSetThreadpoolTimerworkers withMIN_STACKas well.Verification
cargo test -p victory-hle --lib --target x86_64-apple-darwin host_posix --locked -- --test-threads=1(183 passed)cargo test -p victory-hle --test native_probe --target x86_64-apple-darwin --locked -- --test-threads=1(17 passed)cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warningscargo clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-gnullvm -- -D warningscargo xtask policyView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.