Skip to content

Commit

Permalink
aio: windows: initialize ovl on queue
Browse files Browse the repository at this point in the history
  • Loading branch information
Cloudef committed Jul 5, 2024
1 parent 80f3972 commit acd3b40
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/aio/windows.zig
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void {
self.* = undefined;
}

fn queueCallback(_: *@This(), _: u16, _: *Operation.Union) aio.Error!void {}
fn queueCallback(self: *@This(), id: u16, _: *Operation.Union) aio.Error!void {
self.ovls[id] = .{};
}

pub fn queue(self: *@This(), comptime len: u16, work: anytype, cb: ?aio.Dynamic.QueueCallback) aio.Error!void {
try self.uringlator.queue(len, work, cb, *@This(), self, queueCallback);
Expand Down Expand Up @@ -230,7 +232,6 @@ fn start(self: *@This(), id: u16, uop: *Operation.Union) !void {
.read => |op| {
const flags = try getHandleAccessInfo(op.file.handle);
if (flags.FILE_READ_DATA != 1) {
self.ovls[id] = .{};
self.uringlator.finish(id, error.NotOpenForReading);
return;
}
Expand All @@ -243,7 +244,6 @@ fn start(self: *@This(), id: u16, uop: *Operation.Union) !void {
.write => |op| {
const flags = try getHandleAccessInfo(op.file.handle);
if (flags.FILE_WRITE_DATA != 1) {
self.ovls[id] = .{};
self.uringlator.finish(id, error.NotOpenForWriting);
return;
}
Expand Down

0 comments on commit acd3b40

Please sign in to comment.