@@ -22,8 +22,8 @@ import Swift
22
22
/// best applied in situations where the result of a child task is some form
23
23
/// of side-effect.
24
24
///
25
- /// A group waits for all of its child tasks
26
- /// to complete before it returns. Even cancelled tasks must run until
25
+ /// A group *always* waits for all of its child tasks
26
+ /// to complete before it returns. Even canceled tasks must run until
27
27
/// completion before this function returns.
28
28
/// Cancelled child tasks cooperatively react to cancellation and attempt
29
29
/// to return as early as possible.
@@ -41,6 +41,8 @@ import Swift
41
41
/// // guaranteed that slow-task has completed and the group is empty & destroyed
42
42
/// ```
43
43
///
44
+ /// Refer to ``TaskGroup`` documentation for detailed discussion of semantics shared between all task groups.
45
+ ///
44
46
/// Task Group Cancellation
45
47
/// =======================
46
48
///
@@ -65,6 +67,7 @@ import Swift
65
67
/// For tasks that need to handle cancellation by throwing an error,
66
68
/// use the `withThrowingDiscardingTaskGroup(returning:body:)` method instead.
67
69
///
70
+ /// - SeeAlso: ``TaskGroup``
68
71
/// - SeeAlso: ``withThrowingDiscardingTaskGroup(returning:body:)``
69
72
@available ( SwiftStdlib 5 . 9 , * )
70
73
#if !hasFeature(Embedded)
@@ -131,9 +134,7 @@ public func _unsafeInheritExecutor_withDiscardingTaskGroup<GroupResult>(
131
134
/// and mutation operations can't be performed
132
135
/// from a concurrent execution context like a child task.
133
136
///
134
- /// ### Task execution order
135
- /// Tasks added to a task group execute concurrently, and may be scheduled in
136
- /// any order.
137
+ /// Refer to ``TaskGroup`` documentation for detailed discussion of semantics shared between all task groups.
137
138
///
138
139
/// ### Discarding behavior
139
140
/// A discarding task group eagerly discards and releases its child tasks as
@@ -142,18 +143,18 @@ public func _unsafeInheritExecutor_withDiscardingTaskGroup<GroupResult>(
142
143
/// be the case with a ``TaskGroup``.
143
144
///
144
145
/// ### Cancellation behavior
145
- /// A discarding task group becomes cancelled in one of the following ways:
146
+ /// A discarding task group becomes canceled in one of the following ways:
146
147
///
147
148
/// - when ``cancelAll()`` is invoked on it,
148
- /// - when the ``Task`` running this task group is cancelled .
149
+ /// - when the ``Task`` running this task group is canceled .
149
150
///
150
151
/// Since a `DiscardingTaskGroup` is a structured concurrency primitive, cancellation is
151
152
/// automatically propagated through all of its child-tasks (and their child
152
153
/// tasks).
153
154
///
154
- /// A cancelled task group can still keep adding tasks, however they will start
155
- /// being immediately cancelled , and may act accordingly to this. To avoid adding
156
- /// new tasks to an already cancelled task group, use ``addTaskUnlessCancelled(priority:body:)``
155
+ /// A canceled task group can still keep adding tasks, however they will start
156
+ /// being immediately canceled , and may act accordingly to this. To avoid adding
157
+ /// new tasks to an already canceled task group, use ``addTaskUnlessCancelled(priority:body:)``
157
158
/// rather than the plain ``addTask(priority:body:)`` which adds tasks unconditionally.
158
159
///
159
160
/// For information about the language-level concurrency model that `DiscardingTaskGroup` is part of,
@@ -204,7 +205,7 @@ public struct DiscardingTaskGroup {
204
205
/// If you add a task to a group after canceling the group,
205
206
/// that task is canceled immediately after being added to the group.
206
207
///
207
- /// Immediately cancelled child tasks should therefore cooperatively check for and
208
+ /// Immediately canceled child tasks should therefore cooperatively check for and
208
209
/// react to cancellation, e.g. by throwing an `CancellationError` at their
209
210
/// earliest convenience, or otherwise handling the cancellation.
210
211
///
@@ -245,10 +246,10 @@ extension DiscardingTaskGroup: Sendable { }
245
246
/// best applied in situations where the result of a child task is some form
246
247
/// of side-effect.
247
248
///
248
- /// A group waits for all of its child tasks
249
- /// to complete before it returns. Even cancelled tasks must run until
249
+ /// A group *always* waits for all of its child tasks
250
+ /// to complete before it returns. Even canceled tasks must run until
250
251
/// completion before this function returns.
251
- /// Cancelled child tasks cooperatively react to cancellation and attempt
252
+ /// Canceled child tasks cooperatively react to cancellation and attempt
252
253
/// to return as early as possible.
253
254
/// After this function returns, the task group is always empty.
254
255
///
@@ -264,6 +265,8 @@ extension DiscardingTaskGroup: Sendable { }
264
265
/// // guaranteed that slow-task has completed and the group is empty & destroyed
265
266
/// ```
266
267
///
268
+ /// Refer to ``TaskGroup`` documentation for detailed discussion of semantics shared between all task groups.
269
+ ///
267
270
/// Task Group Cancellation
268
271
/// =======================
269
272
///
@@ -411,9 +414,7 @@ public func _unsafeInheritExecutor_withThrowingDiscardingTaskGroup<GroupResult>(
411
414
/// and mutation operations can't be performed
412
415
/// from a concurrent execution context like a child task.
413
416
///
414
- /// ### Task execution order
415
- /// Tasks added to a task group execute concurrently, and may be scheduled in
416
- /// any order.
417
+ /// Refer to ``TaskGroup`` documentation for detailed discussion of semantics shared between all task groups.
417
418
///
418
419
/// ### Discarding behavior
419
420
/// A discarding task group eagerly discards and releases its child tasks as
@@ -422,20 +423,20 @@ public func _unsafeInheritExecutor_withThrowingDiscardingTaskGroup<GroupResult>(
422
423
/// be the case with a ``TaskGroup``.
423
424
///
424
425
/// ### Cancellation behavior
425
- /// A throwing discarding task group becomes cancelled in one of the following ways:
426
+ /// A throwing discarding task group becomes canceled in one of the following ways:
426
427
///
427
428
/// - when ``cancelAll()`` is invoked on it,
428
429
/// - when an error is thrown out of the `withThrowingDiscardingTaskGroup { ... }` closure,
429
- /// - when the ``Task`` running this task group is cancelled .
430
+ /// - when the ``Task`` running this task group is canceled .
430
431
///
431
432
/// But also, and uniquely in *discarding* task groups:
432
433
/// - when *any* of its child tasks throws.
433
434
///
434
- /// The group becoming cancelled automatically, and cancelling all of its child tasks,
435
+ /// The group becoming canceled automatically, and cancelling all of its child tasks,
435
436
/// whenever *any* child task throws an error is a behavior unique to discarding task groups,
436
437
/// because achieving such semantics is not possible otherwise, due to the missing `next()` method
437
438
/// on discarding groups. Accumulating task groups can implement this by manually polling `next()`
438
- /// and deciding to `cancelAll()` when they decide an error should cause the group to become cancelled ,
439
+ /// and deciding to `cancelAll()` when they decide an error should cause the group to become canceled ,
439
440
/// however a discarding group cannot poll child tasks for results and therefore assumes that child
440
441
/// task throws are an indication of a group wide failure. In order to avoid such behavior,
441
442
/// use a ``DiscardingTaskGroup`` instead of a throwing one, or catch specific errors in
@@ -445,9 +446,9 @@ public func _unsafeInheritExecutor_withThrowingDiscardingTaskGroup<GroupResult>(
445
446
/// automatically propagated through all of its child-tasks (and their child
446
447
/// tasks).
447
448
///
448
- /// A cancelled task group can still keep adding tasks, however they will start
449
- /// being immediately cancelled , and may act accordingly to this. To avoid adding
450
- /// new tasks to an already cancelled task group, use ``addTaskUnlessCancelled(priority:body:)``
449
+ /// A canceled task group can still keep adding tasks, however they will start
450
+ /// being immediately canceled , and may act accordingly to this. To avoid adding
451
+ /// new tasks to an already canceled task group, use ``addTaskUnlessCancelled(priority:body:)``
451
452
/// rather than the plain ``addTask(priority:body:)`` which adds tasks unconditionally.
452
453
///
453
454
/// For information about the language-level concurrency model that `DiscardingTaskGroup` is part of,
@@ -496,7 +497,7 @@ public struct ThrowingDiscardingTaskGroup<Failure: Error> {
496
497
/// If you add a task to a group after canceling the group,
497
498
/// that task is canceled immediately after being added to the group.
498
499
///
499
- /// Immediately cancelled child tasks should therefore cooperatively check for and
500
+ /// Immediately canceled child tasks should therefore cooperatively check for and
500
501
/// react to cancellation, e.g. by throwing an `CancellationError` at their
501
502
/// earliest convenience, or otherwise handling the cancellation.
502
503
///
0 commit comments