From b902626a4583f1a91ac822054977a9d702b5a18d Mon Sep 17 00:00:00 2001 From: Adrian Galilea Date: Fri, 28 Aug 2026 19:55:05 +0200 Subject: [PATCH] kqueue: register mach-port wakeups on every Darwin target 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. --- src/backend/kqueue.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/backend/kqueue.zig b/src/backend/kqueue.zig index c419e611..4c99601d 100644 --- a/src/backend/kqueue.zig +++ b/src/backend/kqueue.zig @@ -954,7 +954,7 @@ pub const Loop = struct { // Add to our completion queue c.task_loop.thread_pool_completions.push(c); - if (comptime builtin.target.os.tag == .macos) { + if (comptime builtin.target.os.tag.isDarwin()) { // Wake up our main loop c.task_loop.wakeup() catch {}; } @@ -1070,7 +1070,10 @@ pub const Completion = struct { .udata = @intFromPtr(self), }), - .machport => if (comptime builtin.os.tag != .macos) return null else kevent: { + // Every Darwin target, not just macOS: Async is a mach port on + // all of them (watcher/async.zig picks by isDarwin), and iOS + // silently never registered its wakeups here. + .machport => if (comptime !builtin.os.tag.isDarwin()) return null else kevent: { // We can't use |*v| above because it crahses the Zig // compiler (as of 0.11.0-dev.1413). We can retry another time. const v = &self.op.machport;