authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-05 13:38:32-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-05 13:39:24-07:00
log56265d6f9934f7321d2001c9d07ce82b0c9be126
tree9b91764a4bda077af862a1152cadf1f16d5c46d8
parent3fafbd2e35b05c98971b8d81514d2f92670c7b89

std.Io: clarify Group semantics with respect to async tasks


1 files changed, 11 insertions(+), 9 deletions(-)

lib/std/Io.zig+11-9
......@@ -54,9 +54,6 @@ pub const VTable = struct {
5454 /// If it returns `null` it means `result` has been already populated and
5555 /// `await` will be a no-op.
5656 ///
57 /// When this function returns non-null, the implementation guarantees that
58 /// a unit of concurrency has been assigned to the returned task.
59 ///
6057 /// Thread-safe.
6158 async: *const fn (
6259 /// Corresponds to `Io.userdata`.
......@@ -111,10 +108,6 @@ pub const VTable = struct {
111108 result_alignment: std.mem.Alignment,
112109 ) void,
113110
114 /// When this function returns, implementation guarantees that `start` has
115 /// either already been called, or a unit of concurrency has been assigned
116 /// to the task of calling the function.
117 ///
118111 /// Thread-safe.
119112 groupAsync: *const fn (
120113 /// Corresponds to `Io.userdata`.
......@@ -1251,8 +1244,11 @@ pub const Group = struct {
12511244 /// cancelation propagation boundary.
12521245 ///
12531246 /// Once this function is called, there are resources associated with the
1254 /// group. To release those resources, `Group.await` or `Group.cancel` must
1255 /// eventually be called.
1247 /// group. To release those resources, `await` or `cancel` must eventually
1248 /// be called.
1249 ///
1250 /// `function` is not guaranteed to have been called until `await` or
1251 /// `cancel` is called.
12561252 pub fn async(g: *Group, io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(function))) void {
12571253 const Args = @TypeOf(args);
12581254 const TypeErased = struct {
......@@ -1290,6 +1286,9 @@ pub const Group = struct {
12901286 /// will also cause `error.Canceled` to be returned when the group
12911287 /// does ultimately finish.
12921288 ///
1289 /// After this function returns, all tasks of the `Group` created with
1290 /// `async` or `concurrent` are guaranteed to have run.
1291 ///
12931292 /// Idempotent. Not threadsafe.
12941293 ///
12951294 /// It is safe to call this function concurrently with `Group.async` or
......@@ -1304,6 +1303,9 @@ pub const Group = struct {
13041303 /// Equivalent to `await` but immediately requests cancelation on all
13051304 /// members of the group.
13061305 ///
1306 /// After this function returns, all tasks of the `Group` created with
1307 /// `async` or `concurrent` are guaranteed to have run.
1308 ///
13071309 /// For a description of cancelation and cancelation points, see `Future.cancel`.
13081310 ///
13091311 /// Idempotent. Not threadsafe.