-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
6566 - Add 'run_until_cancelled' to 'tokio_util::sync::CancellationToken' #6618
6566 - Add 'run_until_cancelled' to 'tokio_util::sync::CancellationToken' #6618
Conversation
f1763ca
to
58406d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good overall!
…where it is used and use 'WaitForCancellationFuture'
Co-authored-by: Alice Ryhl <aliceryhl@google.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I only have two remaining things, and otherwise this is ready to be merged.
Co-authored-by: Alice Ryhl <aliceryhl@google.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
Motivation
Citing from #6566:
Solution
I added the described function to
tokio_util::sync::CancellationToken
and added a test case to the loom tests.I also had to add the
macros
feature of Tokio to get access to theselect!
macro. I thought about usingselect!
provided byfutures_util
but that would requireWaitForCancellationFuture
to implementFusedFuture
so I had to stick with the tokio one. But maybe this is a not worthy trade off just for a convenience function?This would close #6566