From e95b26f1c6ae3d7197d9159760006157740b128c Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 10 Jul 2025 09:20:01 -0700 Subject: [PATCH] std.Io: rename go to asyncDetached it's a better name because it's more descriptive, not a reference, and hints that it is less common than async --- lib/std/Io.zig | 6 +++--- lib/std/Io/EventLoop.zig | 4 ++-- lib/std/Io/ThreadPool.zig | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/std/Io.zig b/lib/std/Io.zig index d7da5736f6..3e0dedc1f3 100644 --- a/lib/std/Io.zig +++ b/lib/std/Io.zig @@ -938,7 +938,7 @@ pub const VTable = struct { /// up. This mode does not support results, await, or cancel. /// /// Thread-safe. - go: *const fn ( + asyncDetached: *const fn ( /// Corresponds to `Io.userdata`. userdata: ?*anyopaque, /// Copied and then passed to `start`. @@ -1515,7 +1515,7 @@ pub fn async(io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(functio /// Calls `function` with `args` asynchronously. The resource cleans itself up /// when the function returns. Does not support await, cancel, or a return value. -pub fn go(io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(function))) void { +pub fn asyncDetached(io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(function))) void { const Args = @TypeOf(args); const TypeErased = struct { fn start(context: *const anyopaque) void { @@ -1523,7 +1523,7 @@ pub fn go(io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(function)) @call(.auto, function, args_casted.*); } }; - io.vtable.go(io.userdata, @ptrCast((&args)[0..1]), .of(Args), TypeErased.start); + io.vtable.asyncDetached(io.userdata, @ptrCast((&args)[0..1]), .of(Args), TypeErased.start); } pub fn now(io: Io, clockid: std.posix.clockid_t) ClockGetTimeError!Timestamp { diff --git a/lib/std/Io/EventLoop.zig b/lib/std/Io/EventLoop.zig index 8f9cfd658d..bc760fcfd4 100644 --- a/lib/std/Io/EventLoop.zig +++ b/lib/std/Io/EventLoop.zig @@ -140,7 +140,7 @@ pub fn io(el: *EventLoop) Io { .vtable = &.{ .async = async, .await = await, - .go = go, + .asyncDetached = asyncDetached, .select = select, .cancel = cancel, .cancelRequested = cancelRequested, @@ -776,7 +776,7 @@ const DetachedClosure = struct { } }; -fn go( +fn asyncDetached( userdata: ?*anyopaque, context: []const u8, context_alignment: std.mem.Alignment, diff --git a/lib/std/Io/ThreadPool.zig b/lib/std/Io/ThreadPool.zig index f356a87054..92f97c37fd 100644 --- a/lib/std/Io/ThreadPool.zig +++ b/lib/std/Io/ThreadPool.zig @@ -332,7 +332,7 @@ pub fn io(pool: *Pool) Io { .vtable = &.{ .async = async, .await = await, - .go = go, + .asyncDetached = asyncDetached, .cancel = cancel, .cancelRequested = cancelRequested, .select = select, @@ -521,7 +521,7 @@ const DetachedClosure = struct { } }; -fn go( +fn asyncDetached( userdata: ?*anyopaque, context: []const u8, context_alignment: std.mem.Alignment,