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-07-20 10:38:39-07:00
loge95b26f1c6ae3d7197d9159760006157740b128c
treede13bfcca15b9964693edbde92ec98ac2bdeba14
parent38152c2d1c3711edb3a4f43a1cabd5690d241a7c

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
...@@ -938,7 +938,7 @@ pub const VTable = struct {...@@ -938,7 +938,7 @@ pub const VTable = struct {
938 /// up. This mode does not support results, await, or cancel.938 /// up. This mode does not support results, await, or cancel.
939 ///939 ///
940 /// Thread-safe.940 /// Thread-safe.
941 go: *const fn (941 asyncDetached: *const fn (
942 /// Corresponds to `Io.userdata`.942 /// Corresponds to `Io.userdata`.
943 userdata: ?*anyopaque,943 userdata: ?*anyopaque,
944 /// Copied and then passed to `start`.944 /// Copied and then passed to `start`.
...@@ -1515,7 +1515,7 @@ pub fn async(io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(functio...@@ -1515,7 +1515,7 @@ pub fn async(io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(functio
15151515
1516/// Calls `function` with `args` asynchronously. The resource cleans itself up1516/// Calls `function` with `args` asynchronously. The resource cleans itself up
1517/// when the function returns. Does not support await, cancel, or a return value.1517/// when the function returns. Does not support await, cancel, or a return value.
1518pub fn go(io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(function))) void {1518pub fn asyncDetached(io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(function))) void {
1519 const Args = @TypeOf(args);1519 const Args = @TypeOf(args);
1520 const TypeErased = struct {1520 const TypeErased = struct {
1521 fn start(context: *const anyopaque) void {1521 fn start(context: *const anyopaque) void {
...@@ -1523,7 +1523,7 @@ pub fn go(io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(function))...@@ -1523,7 +1523,7 @@ pub fn go(io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(function))
1523 @call(.auto, function, args_casted.*);1523 @call(.auto, function, args_casted.*);
1524 }1524 }
1525 };1525 };
1526 io.vtable.go(io.userdata, @ptrCast((&args)[0..1]), .of(Args), TypeErased.start);1526 io.vtable.asyncDetached(io.userdata, @ptrCast((&args)[0..1]), .of(Args), TypeErased.start);
1527}1527}
15281528
1529pub fn now(io: Io, clockid: std.posix.clockid_t) ClockGetTimeError!Timestamp {1529pub 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 {...@@ -140,7 +140,7 @@ pub fn io(el: *EventLoop) Io {
140 .vtable = &.{140 .vtable = &.{
141 .async = async,141 .async = async,
142 .await = await,142 .await = await,
143 .go = go,143 .asyncDetached = asyncDetached,
144 .select = select,144 .select = select,
145 .cancel = cancel,145 .cancel = cancel,
146 .cancelRequested = cancelRequested,146 .cancelRequested = cancelRequested,
...@@ -776,7 +776,7 @@ const DetachedClosure = struct {...@@ -776,7 +776,7 @@ const DetachedClosure = struct {
776 }776 }
777};777};
778778
779fn go(779fn asyncDetached(
780 userdata: ?*anyopaque,780 userdata: ?*anyopaque,
781 context: []const u8,781 context: []const u8,
782 context_alignment: std.mem.Alignment,782 context_alignment: std.mem.Alignment,
lib/std/Io/ThreadPool.zig+2-2
...@@ -332,7 +332,7 @@ pub fn io(pool: *Pool) Io {...@@ -332,7 +332,7 @@ pub fn io(pool: *Pool) Io {
332 .vtable = &.{332 .vtable = &.{
333 .async = async,333 .async = async,
334 .await = await,334 .await = await,
335 .go = go,335 .asyncDetached = asyncDetached,
336 .cancel = cancel,336 .cancel = cancel,
337 .cancelRequested = cancelRequested,337 .cancelRequested = cancelRequested,
338 .select = select,338 .select = select,
...@@ -521,7 +521,7 @@ const DetachedClosure = struct {...@@ -521,7 +521,7 @@ const DetachedClosure = struct {
521 }521 }
522};522};
523523
524fn go(524fn asyncDetached(
525 userdata: ?*anyopaque,525 userdata: ?*anyopaque,
526 context: []const u8,526 context: []const u8,
527 context_alignment: std.mem.Alignment,527 context_alignment: std.mem.Alignment,