authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-07-10 09:20:01-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-10-02 16:30:59-07:00
log806214797a124b175a2318cf25f487970f4518a4
treeb50a67e79947d8b226a4f4c2f556a898d485afc5
parent9a62dc4d89e0874d3f5d2bebee11d57bdce8b0d5

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

3 files changed, 7 insertions(+), 7 deletions(-)

lib/std/Io.zig+3-3
......@@ -585,7 +585,7 @@ pub const VTable = struct {
585585 /// up. This mode does not support results, await, or cancel.
586586 ///
587587 /// Thread-safe.
588 go: *const fn (
588 asyncDetached: *const fn (
589589 /// Corresponds to `Io.userdata`.
590590 userdata: ?*anyopaque,
591591 /// Copied and then passed to `start`.
......@@ -1162,7 +1162,7 @@ pub fn async(io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(functio
11621162
11631163/// Calls `function` with `args` asynchronously. The resource cleans itself up
11641164/// when the function returns. Does not support await, cancel, or a return value.
1165pub fn go(io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(function))) void {
1165pub fn asyncDetached(io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(function))) void {
11661166 const Args = @TypeOf(args);
11671167 const TypeErased = struct {
11681168 fn start(context: *const anyopaque) void {
......@@ -1170,7 +1170,7 @@ pub fn go(io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(function))
11701170 @call(.auto, function, args_casted.*);
11711171 }
11721172 };
1173 io.vtable.go(io.userdata, @ptrCast((&args)[0..1]), .of(Args), TypeErased.start);
1173 io.vtable.asyncDetached(io.userdata, @ptrCast((&args)[0..1]), .of(Args), TypeErased.start);
11741174}
11751175
11761176pub fn now(io: Io, clockid: std.posix.clockid_t) ClockGetTimeError!Timestamp {
lib/std/Io/EventLoop.zig+2-2
......@@ -140,7 +140,7 @@ pub fn io(el: *EventLoop) Io {
140140 .vtable = &.{
141141 .async = async,
142142 .await = await,
143 .go = go,
143 .asyncDetached = asyncDetached,
144144 .select = select,
145145 .cancel = cancel,
146146 .cancelRequested = cancelRequested,
......@@ -776,7 +776,7 @@ const DetachedClosure = struct {
776776 }
777777};
778778
779fn go(
779fn asyncDetached(
780780 userdata: ?*anyopaque,
781781 context: []const u8,
782782 context_alignment: std.mem.Alignment,
lib/std/Io/ThreadPool.zig+2-2
......@@ -332,7 +332,7 @@ pub fn io(pool: *Pool) Io {
332332 .vtable = &.{
333333 .async = async,
334334 .await = await,
335 .go = go,
335 .asyncDetached = asyncDetached,
336336 .cancel = cancel,
337337 .cancelRequested = cancelRequested,
338338 .select = select,
......@@ -521,7 +521,7 @@ const DetachedClosure = struct {
521521 }
522522};
523523
524fn go(
524fn asyncDetached(
525525 userdata: ?*anyopaque,
526526 context: []const u8,
527527 context_alignment: std.mem.Alignment,