Skip to content

kqueue: register mach-port wakeups on every Darwin target (iOS never woke) - #238

Open
adriangalilea wants to merge 1 commit into
mitchellh:mainfrom
adriangalilea:ios-machport
Open

kqueue: register mach-port wakeups on every Darwin target (iOS never woke)#238
adriangalilea wants to merge 1 commit into
mitchellh:mainfrom
adriangalilea:ios-machport

Conversation

@adriangalilea

Copy link
Copy Markdown

`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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant