authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-11-21 08:49:26-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-11-21 19:54:41-08:00
logb4ec78906cdb2a13b08f94690fb270726bbdb819
treeb7aa7cc8716686ed4489808b7b04c1a4346e48aa
parent69f9395b382eb564285367e539d43dc6c8edd257

std.Io: update async documentation to reflect the guarantee


1 files changed, 16 insertions(+), 2 deletions(-)

lib/std/Io.zig+16-2
......@@ -580,6 +580,9 @@ pub const VTable = struct {
580580 /// If it returns `null` it means `result` has been already populated and
581581 /// `await` will be a no-op.
582582 ///
583 /// When this function returns non-null, the implementation guarantees that
584 /// a unit of concurrency has been assigned to the returned task.
585 ///
583586 /// Thread-safe.
584587 async: *const fn (
585588 /// Corresponds to `Io.userdata`.
......@@ -1024,6 +1027,10 @@ pub const Group = struct {
10241027 ///
10251028 /// `function` *may* be called immediately, before `async` returns.
10261029 ///
1030 /// When this function returns, it is guaranteed that `function` has
1031 /// already been called and completed, or it has successfully been assigned
1032 /// a unit of concurrency.
1033 ///
10271034 /// After this is called, `wait` or `cancel` must be called before the
10281035 /// group is deinitialized.
10291036 ///
......@@ -1094,6 +1101,10 @@ pub fn Select(comptime U: type) type {
10941101 ///
10951102 /// `function` *may* be called immediately, before `async` returns.
10961103 ///
1104 /// When this function returns, it is guaranteed that `function` has
1105 /// already been called and completed, or it has successfully been
1106 /// assigned a unit of concurrency.
1107 ///
10971108 /// After this is called, `wait` or `cancel` must be called before the
10981109 /// select is deinitialized.
10991110 ///
......@@ -1524,8 +1535,11 @@ pub fn Queue(Elem: type) type {
15241535/// not guaranteed to be available until `await` is called.
15251536///
15261537/// `function` *may* be called immediately, before `async` returns. This has
1527/// weaker guarantees than `concurrent`, making more portable and
1528/// reusable.
1538/// weaker guarantees than `concurrent`, making more portable and reusable.
1539///
1540/// When this function returns, it is guaranteed that `function` has already
1541/// been called and completed, or it has successfully been assigned a unit of
1542/// concurrency.
15291543///
15301544/// See also:
15311545/// * `Group`