···1616capability of io_uring to pass a completion from one ring to another. This
1717allows a multithreaded application to implement message passing using io_uring
1818(or kqueue, if that's your flavor). Multithreaded applications should plan to
1919-use one `Runtime` per thread. Submission onto the runtime is not thread safe,
1919+use one `Ring` per thread. Submission onto the runtime is not thread safe,
2020any message passing must occur using `msg_ring` rather than directly submitting
2121a task to another
2222···6161 .req = .{ .userfd = fd },
6262};
63636464-// Send target_task from the main_rt thread to the thread_rt Runtime. The
6565-// thread_rt Runtime will then // process the task as a completion, ie
6464+// Send target_task from the main_rt thread to the thread_rt Ring. The
6565+// thread_rt Ring will then // process the task as a completion, ie
6666// Worker.onCompletion will be called with // this task. That thread can then
6767// schedule a recv, a write, etc on the file // descriptor it just received.
6868_ = try main_rt.msgRing(thread_rt, target_task, .{});
6969```
70707171-### Multiple Runtimes on the same thread
7171+### Multiple Rings on the same thread
72727373-You can have multiple Runtimes in a single thread. One could be a priority
7474-Runtime, or handle specific types of tasks, etc. Poll any runtime from any other
7373+You can have multiple Rings in a single thread. One could be a priority
7474+Ring, or handle specific types of tasks, etc. Poll any runtime from any other
7575runtime.
76767777```zig
···110110 try self.buf.appendSlice(gpa, bytes);
111111 }
112112113113- pub fn flush(self: *MultiWriter, rt: *io.Runtime) !void {
113113+ pub fn flush(self: *MultiWriter, rt: *io.Ring) !void {
114114 if (self.fd1_written < self.buf.items.len) {
115115 _ = try rt.write(self.fd1, self.buf.items[self.fd1_written..], .{
116116 .ptr = self,
···128128 }
129129 }
130130131131- pub fn onCompletion(rt: *io.Runtime, task: io.Task) anyerror!void {
131131+ pub fn onCompletion(rt: *io.Ring, task: io.Task) anyerror!void {
132132 const self = task.userdataCast(MultiWriter);
133133 const result = task.result.?;
134134···151151152152pub fn main() !void {
153153 var gpa: std.heap.DebugAllocator(.{}) = .init;
154154- var rt: io.Runtime = try .init(gpa.allocator(), 16);
154154+ var rt: io.Ring = try .init(gpa.allocator(), 16);
155155 defer rt.deinit();
156156157157 // Pretend I created some files