You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: stdlib/public/Concurrency/TaskGroup.swift
+26-21Lines changed: 26 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -110,7 +110,7 @@ public func withTaskGroup<ChildTaskResult, GroupResult>(
110
110
// Run the withTaskGroup body.
111
111
letresult=awaitbody(&group)
112
112
113
-
let _:ChildTaskResult?=try?await_taskGroupWaitAll(group: _group) // try!-safe, cannot throw since this is a non throwing group
113
+
let _:ChildTaskResult?=try?await_taskGroupWaitAll(group: _group, childFailureCancelsGroup: discardResults) // try!-safe, cannot throw since this is a non throwing group
114
114
return result
115
115
}
116
116
@@ -198,14 +198,14 @@ public func withThrowingTaskGroup<ChildTaskResult, GroupResult>(
/// A group that contains dynamically created child tasks.
@@ -514,7 +510,7 @@ public struct TaskGroup<ChildTaskResult: Sendable> {
514
510
/// implementation.
515
511
if #available(SwiftStdlib 5.8,*){
516
512
if isDiscardingResults {
517
-
let _:ChildTaskResult?=try!await_taskGroupWaitAll(group: _group) // try!-safe, cannot throw, not throwing group
513
+
let _:ChildTaskResult?=try!await_taskGroupWaitAll(group: _group, childFailureCancelsGroup: isDiscardingResults) // try!-safe, cannot throw, not throwing group
/// Since 5.8, we implement "wait for all pending tasks to complete"
646
651
/// in the runtime, in order to be able to handle the discard-results
647
652
/// implementation.
648
653
if #available(SwiftStdlib 5.8,*){
649
654
if isDiscardingResults {
650
-
let _:ChildTaskResult?=tryawait_taskGroupWaitAll(group: _group) // if any of the tasks throws, this will "rethrow" here
655
+
let _:ChildTaskResult?=tryawait_taskGroupWaitAll(group: _group, childFailureCancelsGroup: childFailureCancelsGroup) // if any of the tasks throws, this will "rethrow" here
0 commit comments