Skip to content

Correct lifetime based cancellation of AsyncStream and AsyncThrowingStream #40087

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

Conversation

phausler
Copy link
Contributor

@phausler phausler commented Nov 8, 2021

This addresses an outstanding issue where AsyncStream and AsyncThrowingStream could not terminate in the case of indefinite sequences for a handler that lived by capture. AsyncStream and AsyncThrowingStream now hold a context that cancels on deinitialization.

Resolves radar: rdar://82985344

Tests incoming soon.

@phausler
Copy link
Contributor Author

phausler commented Nov 8, 2021

@swift-ci please smoke test

@phausler
Copy link
Contributor Author

phausler commented Nov 9, 2021

@swift-ci please smoke test

@phausler phausler requested a review from DougGregor November 10, 2021 17:29
Copy link
Contributor

@ktoso ktoso left a comment

Choose a reason for hiding this comment

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

LGTM

}
return result
} onCancel: {
storage.value = nil
Copy link
Contributor

Choose a reason for hiding this comment

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

okey and that write is lock protected... looks good

@phausler phausler merged commit 71cc766 into swiftlang:main Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants