Commit f5d8492b1f

Andrew Kelley <andrew@ziglang.org>
2025-07-10 18:20:01
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
1 parent 14c3dc4
Changed files (3)
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,
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,
lib/std/Io.zig
@@ -585,7 +585,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`.
@@ -1162,7 +1162,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 {
@@ -1170,7 +1170,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 {