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
This commit is contained in:
Andrew Kelley 2025-07-10 09:20:01 -07:00
parent 9a62dc4d89
commit 806214797a
3 changed files with 7 additions and 7 deletions

View File

@ -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 {

View File

@ -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,

View File

@ -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,