Skip to content

Commit

Permalink
task: add cancel safety docs to JoinHandle (#4901)
Browse files Browse the repository at this point in the history
  • Loading branch information
Darksonn committed Aug 11, 2022
1 parent 53e1272 commit bdbb0ec
Showing 1 changed file with 9 additions and 0 deletions.
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

0 comments on commit bdbb0ec

Please sign in to comment.