std.Io: update async documentation to reflect the guarantee

This commit is contained in:
Andrew Kelley 2025-11-21 08:49:26 -08:00
parent 69f9395b38
commit b4ec78906c

View File

@ -580,6 +580,9 @@ pub const VTable = struct {
/// If it returns `null` it means `result` has been already populated and /// If it returns `null` it means `result` has been already populated and
/// `await` will be a no-op. /// `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. /// Thread-safe.
async: *const fn ( async: *const fn (
/// Corresponds to `Io.userdata`. /// Corresponds to `Io.userdata`.
@ -1024,6 +1027,10 @@ pub const Group = struct {
/// ///
/// `function` *may* be called immediately, before `async` returns. /// `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 /// After this is called, `wait` or `cancel` must be called before the
/// group is deinitialized. /// group is deinitialized.
/// ///
@ -1094,6 +1101,10 @@ pub fn Select(comptime U: type) type {
/// ///
/// `function` *may* be called immediately, before `async` returns. /// `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 /// After this is called, `wait` or `cancel` must be called before the
/// select is deinitialized. /// select is deinitialized.
/// ///
@ -1524,8 +1535,11 @@ pub fn Queue(Elem: type) type {
/// not guaranteed to be available until `await` is called. /// not guaranteed to be available until `await` is called.
/// ///
/// `function` *may* be called immediately, before `async` returns. This has /// `function` *may* be called immediately, before `async` returns. This has
/// weaker guarantees than `concurrent`, making more portable and /// weaker guarantees than `concurrent`, making more portable and reusable.
/// 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: /// See also:
/// * `Group` /// * `Group`