zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit b4ec78906cdb2a13b08f94690fb270726bbdb819 (tree)
parent 69f9395b382eb564285367e539d43dc6c8edd257
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Fri, 21 Nov 2025 08:49:26 -0800

std.Io: update async documentation to reflect the guarantee

Diffstat:
Mlib/std/Io.zig | 18++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/lib/std/Io.zig b/lib/std/Io.zig @@ -580,6 +580,9 @@ pub const VTable = struct { /// If it returns `null` it means `result` has been already populated and /// `await` will be a no-op. /// + /// When this function returns non-null, the implementation guarantees that + /// a unit of concurrency has been assigned to the returned task. + /// /// Thread-safe. async: *const fn ( /// Corresponds to `Io.userdata`. @@ -1024,6 +1027,10 @@ pub const Group = struct { /// /// `function` *may* be called immediately, before `async` returns. /// + /// When this function returns, it is guaranteed that `function` has + /// already been called and completed, or it has successfully been assigned + /// a unit of concurrency. + /// /// After this is called, `wait` or `cancel` must be called before the /// group is deinitialized. /// @@ -1094,6 +1101,10 @@ pub fn Select(comptime U: type) type { /// /// `function` *may* be called immediately, before `async` returns. /// + /// When this function returns, it is guaranteed that `function` has + /// already been called and completed, or it has successfully been + /// assigned a unit of concurrency. + /// /// After this is called, `wait` or `cancel` must be called before the /// select is deinitialized. /// @@ -1524,8 +1535,11 @@ pub fn Queue(Elem: type) type { /// not guaranteed to be available until `await` is called. /// /// `function` *may* be called immediately, before `async` returns. This has -/// weaker guarantees than `concurrent`, making more portable and -/// reusable. +/// weaker guarantees than `concurrent`, making more portable and reusable. +/// +/// When this function returns, it is guaranteed that `function` has already +/// been called and completed, or it has successfully been assigned a unit of +/// concurrency. /// /// See also: /// * `Group`