Skip to content
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

task: add cancel safety docs to JoinHandle #4901

Merged
merged 2 commits into from Aug 11, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions tokio/src/runtime/task/join.rs
Expand Up @@ -20,6 +20,15 @@ cfg_rt! {
/// This `struct` is created by the [`task::spawn`] and [`task::spawn_blocking`]
/// functions.
///
/// # Cancel safety
///
/// The `&mut JoinHandle<T>` type is cancel safe. If it is used as the event
/// in a `tokio::select!` statement and some other branch completes first,
/// then it is guaranteed that the output of the task is not lost.
///
/// If a `JoinHandle` is dropped, then the task continues running in the
/// background and its return value is lost.
///
/// # Examples
///
/// Creation from [`task::spawn`]:
Expand Down