Skip to content

Commit

Permalink
Add guarantee about when a spawned task may be polled
Browse files Browse the repository at this point in the history
  • Loading branch information
Diggsey committed Jun 25, 2023
1 parent 910a1e2 commit 279a62b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tokio/src/task/spawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ cfg_rt! {
/// different thread to be executed. The specifics depend on the current
/// [`Runtime`](crate::runtime::Runtime) configuration.
///
/// If the task is executed on the current thread it will not begin executing
/// until the current task yields to the executor. In other words, `spawn`
/// will not synchronously poll the task. As a result, calling `spawn`
/// whilst holding a lock does not pose a risk of deadlocking with the
/// spawned task.
///
/// There is no guarantee that a spawned task will execute to completion.
/// When a runtime is shutdown, all outstanding tasks are dropped,
/// regardless of the lifecycle of that task.
Expand Down

0 comments on commit 279a62b

Please sign in to comment.