Keep the macOS viewer out of App Nap while it runs - #902
Merged
Merged
Conversation
Nothing opted out, so a covered viewer could be napped: timers coalesced and priority lowered, for a process whose loop is driven from outside a frame at a time and which answers a socket beside it. A failing test's inline send could wait on it, and the window come forward late. The runtime takes out a userInitiatedAllowingIdleSystemSleep activity when it opens and ends it at shutdown. Idle sleep is still allowed, and since the loop only redraws on a change, staying awake costs one event pump a frame.
This was referenced Sep 23, 2026
Merged
Merged
Merged
Merged
Merged
This was referenced Sep 24, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the macOS App Nap item in
todo.md.Nothing opted out of App Nap, so a covered viewer could be napped: timers coalesced and priority lowered. This process's loop is driven from outside, one frame at a time, with a socket listener beside it. So a failing test's inline send could wait on it, and its window could come forward late.
Runtime.opennow takes out auserInitiatedAllowingIdleSystemSleepactivity, andshutdownends it. Idle sleep is still allowed. Since #898 the loop only redraws on a change, so staying out of App Nap costs one event pump per frame. It also covers a hidden viewer that owns the queue, which still has to answer every send promptly.Not verified: there's no Mac here, so CI compiling the Swift and running the macOS tests is the only check. The todo item's steps would confirm it: cover the viewer for a minute, check Activity Monitor no longer shows it napping, then time how long a failing inline test takes to bring it forward.
Binaries rebuilt by
build-native(#900, fast-forwarded into this branch).Merge #901 first. Both replace the macOS library, and #901 also moves the ABI to 9. After it merges, this branch needs
mainmerged in and its binaries rebuilt, or it would put a version 8 library back.