mirror of
https://github.com/ziglang/zig.git
synced 2026-02-18 15:31:48 +00:00
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:
parent
9a62dc4d89
commit
806214797a
@ -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 {
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user