diff --git a/src/aio/common/posix.zig b/src/aio/common/posix.zig index 05ebcce..08c5c79 100644 --- a/src/aio/common/posix.zig +++ b/src/aio/common/posix.zig @@ -7,7 +7,12 @@ pub const PIDFD_NONBLOCK = @as(usize, 1 << @bitOffsetOf(std.posix.O, "NONBLOCK") pub const EventSource = struct { fd: std.posix.fd_t, - counter: std.atomic.Value(u32) = std.atomic.Value(u32).init(0), + _: if (@hasDecl(std.posix.system, "kqueue")) + struct { + counter: std.atomic.Value(u32) = std.atomic.Value(u32).init(0), + } + else + struct {} = .{}, pub inline fn init() !@This() { if (comptime @hasDecl(std.posix.system, "eventfd")) { @@ -34,7 +39,7 @@ pub const EventSource = struct { _ = std.posix.write(self.fd, &std.mem.toBytes(@as(u64, 1))) catch continue; } else if (comptime @hasDecl(std.posix.system, "kqueue")) { _ = std.posix.kevent(self.fd, &.{.{ - .ident = self.counter.fetchAdd(1, .monotonic), + .ident = self._.counter.fetchAdd(1, .monotonic), .filter = std.posix.system.EVFILT_USER, .flags = std.posix.system.EV_ADD | std.posix.system.EV_ENABLE | std.posix.system.EV_ONESHOT, .fflags = std.posix.system.NOTE_TRIGGER,