kqueue: register mach-port wakeups on every Darwin target (iOS never woke) - #238
Open
adriangalilea wants to merge 1 commit into
Open
kqueue: register mach-port wakeups on every Darwin target (iOS never woke)#238adriangalilea wants to merge 1 commit into
adriangalilea wants to merge 1 commit into
Conversation
Async picks the mach-port implementation for all Darwin targets, but the kqueue backend only emitted the EVFILT_MACHPORT kevent (and the thread pool's loop wakeup) when os.tag == .macos. On iOS every Async wait was silently never registered: loops never woke, never stopped.
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.
`watcher/async.zig` selects the mach-port `Async` implementation for every Darwin target (`builtin.target.os.tag.isDarwin()`), but `backend/kqueue.zig` only emitted the `EVFILT_MACHPORT` kevent for a `.machport` operation, and only woke the loop from the thread pool, when `os.tag == .macos`.
On iOS the result is silent: every `Async.wait` returns without registering anything, so `notify()` succeeds and nothing ever fires. In Ghostty's iOS build that meant the renderer never drew its first frame, the io thread never woke for its mailbox, and `stop` never stopped a loop (`pthread_join` hang on surface teardown). Verified on an iPhone 17 Pro / iOS 26: a direct `EVFILT_MACHPORT` registration wakes fine there, so the gate was the only thing in the way.
This widens both gates to `isDarwin()`. No behaviour change on macOS.