perf(window): block message loop while paused on Win32 (#134) #152
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Catcrafts/Crafter.Graphics!152
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/issue-134"
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?
Problem
In
StartSync()(implementations/Crafter.Graphics-Window.cpp), whenupdatingis false (paused / minimized / stopped) the FIFO present no longer paces the loop, so the barePeekMessage(PM_REMOVE)spin pins a core at 100% while uselessly re-runningGamepad::Tick()(mutex + per-padGetCurrentReadingCOM call) andonBeforeUpdateevery iteration.Fix
Block on
MsgWaitForMultipleObjectsExwith a short (~16ms) timeout while!updating. The loop wakes on input or after the timeout, eliminating the busy-spin while preserving gamepad polling /onBeforeUpdateat a sane rate (e.g. to detect a controller button asking to resume). Theupdatingpath is untouched — present remains vsync-gated, so per-frame polling stays correctly vsync-gated.Testing
crafter-build test— 24/24 pass on the Linux/Wayland build (which compilesCrafter.Graphics-Window.cpp).windows.h(MsgWaitForMultipleObjectsEx,QS_ALLINPUT,MWMO_INPUTAVAILABLE). A full Windows cross-compile is blocked by a pre-existing mingw WinRT header issue inCrafter.Graphics-Gamepad.cpp, unrelated to this change.Resolves #134
🤖 Generated with Claude Code