Repository navigation
Use kevent64 throughout the macOS poll waiter - #134
Merged
Merged
Conversation
Owner
|
Thank you, I hate MacOS for reasons like this. Will probably merge tomorrow. |
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.
On macOS the availability poll thread scans once, establishes its baseline, and never scans again, so no change is ever reported:
MacWaiterregisters itsEVFILT_USERevent withkevent, then adds the poll timer withkevent64and waits withkevent. XNU tags a kqueue with the first variant used on it and rejects the others withEINVAL, so thekevent64call that adds the timer fails. Its result is not checked, the wait has no timeout, and the thread sleeps untilwake()fires at shutdown.What this does
Uses
kevent64for every call on the kqueue. The timer already needed it forNOTE_LEEWAY, so the other three calls move over to match.Testing
Ran on GitHub's
macos-latest(arm64) andmacos-15-intelrunners with a custom backend whoseis_supportedis toggled at a 20 ms poll interval. Before, going unavailable was never reported. After, both transitions are reported.