From c24fdf39232e980277608932347f593484f20efc Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Fri, 28 Jun 2024 11:57:05 +0900 Subject: [PATCH] io_uring: remove NOP queue on nonblocking mode not sure why this was neccessary? maybe unrelated issue ... --- src/aio/IoUring.zig | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/aio/IoUring.zig b/src/aio/IoUring.zig index d790d32..de617bd 100644 --- a/src/aio/IoUring.zig +++ b/src/aio/IoUring.zig @@ -104,22 +104,15 @@ pub fn queue(self: *@This(), comptime len: u16, work: anytype, cb: ?aio.Dynamic. } } -pub const NOP = std.math.maxInt(u64); - /// TODO: give options perhaps? More customization? pub fn complete(self: *@This(), mode: aio.Dynamic.CompletionMode, cb: ?aio.Dynamic.CompletionCallback) aio.Error!aio.CompletionResult { if (self.ops.empty()) return .{}; - if (mode == .nonblocking) { - _ = try self.io.nop(NOP); - } - _ = try uring_submit(&self.io); var result: aio.CompletionResult = .{}; - const n = try uring_copy_cqes(&self.io, self.cqes, 1); + const n = try uring_copy_cqes(&self.io, self.cqes, if (mode == .nonblocking) 0 else 1); for (self.cqes[0..n]) |*cqe| { - if (cqe.user_data == NOP) continue; const uop = self.ops.get(@intCast(cqe.user_data)).*; var failed: bool = false; switch (uop) { @@ -132,7 +125,7 @@ pub fn complete(self: *@This(), mode: aio.Dynamic.CompletionMode, cb: ?aio.Dynam if (cb) |f| f(uop, @enumFromInt(cqe.user_data), failed); } - result.num_completed = n - @intFromBool(mode == .nonblocking); + result.num_completed = n; return result; }