Skip to content

Commit 657fd88

Browse files
authored
task: add guarantee about when a spawned task may be polled (#5816)
1 parent 6b076a2 commit 657fd88

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tokio/src/task/spawn.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ cfg_rt! {
1515
/// different thread to be executed. The specifics depend on the current
1616
/// [`Runtime`](crate::runtime::Runtime) configuration.
1717
///
18+
/// It is guaranteed that spawn will not synchronously poll the task being spawned.
19+
/// This means that calling spawn while holding a lock does not pose a risk of
20+
/// deadlocking with the spawned task.
21+
///
1822
/// There is no guarantee that a spawned task will execute to completion.
1923
/// When a runtime is shutdown, all outstanding tasks are dropped,
2024
/// regardless of the lifecycle of that task.

0 commit comments

Comments
 (0)