Skip to content

[Docs][Concurrency] TaskGroup docs: waitForAll (non-)cancellation #63956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 28, 2023

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented Feb 28, 2023

Resolves rdar://105973001

This behavior is expected, however was not documented so a bug fix of the group previously not properly awaiting all tasks now made this behavior surprising. The solution is not to change the behavior, but to make it documented.

Please review @FranzBusch

@ktoso ktoso added the concurrency Feature: umbrella label for concurrency language features label Feb 28, 2023
@ktoso
Copy link
Contributor Author

ktoso commented Feb 28, 2023

@swift-ci please smoke test

@ktoso ktoso changed the title [Concurrency] Document waitForAll behavior in more depth [Concurrency] Document waitForAll (non-)cancellation behavior in more depth Feb 28, 2023
@ktoso
Copy link
Contributor Author

ktoso commented Feb 28, 2023

While in here is potted some wrong documentation... let me fix that.

@ktoso ktoso changed the title [Concurrency] Document waitForAll (non-)cancellation behavior in more depth [Concurrency] TaskGroup docs: waitForAll (non-)cancellation, and fixes about cancellation semantics Feb 28, 2023
@ktoso ktoso changed the title [Concurrency] TaskGroup docs: waitForAll (non-)cancellation, and fixes about cancellation semantics [Concurrency] TaskGroup docs: waitForAll (non-)cancellation, and fixes cancellation semantics docs Feb 28, 2023
@ktoso ktoso changed the title [Concurrency] TaskGroup docs: waitForAll (non-)cancellation, and fixes cancellation semantics docs [Docs][Concurrency] TaskGroup docs: waitForAll (non-)cancellation, and fixes cancellation semantics docs Feb 28, 2023
@ktoso ktoso changed the title [Docs][Concurrency] TaskGroup docs: waitForAll (non-)cancellation, and fixes cancellation semantics docs [Docs][Concurrency] TaskGroup docs: waitForAll (non-)cancellation Feb 28, 2023
/// ```
///
/// - Throws: The *first* error that was thrown by a child task during draining all the tasks.
/// This first error is stored until all other tasks have completed, and is re-thrown afterwards.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only instance of waitForAll which has such special semantics.

Discarding groups don't have this API, nor can they use next(), and a not throwing one cannot throw so this cannot happen

@ktoso
Copy link
Contributor Author

ktoso commented Feb 28, 2023

@swift-ci please smoke test

Copy link
Member

@FranzBusch FranzBusch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying this!

@ktoso ktoso merged commit 3ffb339 into swiftlang:main Feb 28, 2023
@ktoso ktoso deleted the wip-group-docs branch February 28, 2023 08:31
Copy link

@JJJensen JJJensen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by review after merging...

/// } catch is CancellationError {
/// // we decide that cancellation errors thrown by children,
/// // should not cause cancellation of the entire group.
/// continue;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👽 ;

/// // should not cause cancellation of the entire group.
/// continue;
/// } catch {
/// // other errors though we print and cancel the group,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not really print, I guess.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks will add

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
concurrency Feature: umbrella label for concurrency language features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants