From 4e78aa6fd2718cbcc4867f055a379739ff780abd Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Tue, 29 Apr 2025 08:51:34 -0500 Subject: [PATCH] ourio: add open method --- src/ourio.zig | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/ourio.zig b/src/ourio.zig index f4d8b65..9bc597a 100644 --- a/src/ourio.zig +++ b/src/ourio.zig @@ -413,6 +413,25 @@ pub const Ring = struct { return task; } + pub fn open( + self: *Ring, + path: [:0]const u8, + flags: posix.O, + mode: posix.mode_t, + ctx: Context, + ) Allocator.Error!*Task { + const task = try self.getTask(); + task.* = .{ + .userdata = ctx.ptr, + .msg = ctx.msg, + .callback = ctx.cb, + .req = .{ .open = .{ .path = path, .flags = flags, .mode = mode } }, + }; + + self.submission_q.push(task); + return task; + } + /// Spawns a thread with a Ring instance. The thread will be idle and waiting to receive work /// via msgRing when this function returns. Call kill on the returned thread to signal it to /// shutdown. -- 2.51.2