Skip to content

Commit 2298679

Browse files
authored
runtime: document the nature of the main future (#5494)
1 parent cadcd5d commit 2298679

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

tokio-macros/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ use proc_macro::TokenStream;
3939
/// function is called often, it is preferable to create the runtime using the
4040
/// runtime builder so the runtime can be reused across calls.
4141
///
42+
/// # Non-worker async function
43+
///
44+
/// Note that the async function marked with this macro does not run as a
45+
/// worker. The expectation is that other tasks are spawned by the function here.
46+
/// Awaiting on other futures from the function provided here will not
47+
/// perform as fast as those spawned as workers.
48+
///
4249
/// # Multi-threaded runtime
4350
///
4451
/// To use the multi-threaded runtime, the macro can be configured using

tokio/src/runtime/runtime.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,13 @@ impl Runtime {
240240
/// complete, and yielding its resolved result. Any tasks or timers
241241
/// which the future spawns internally will be executed on the runtime.
242242
///
243+
/// # Non-worker future
244+
///
245+
/// Note that the future required by this function does not run as a
246+
/// worker. The expectation is that other tasks are spawned by the future here.
247+
/// Awaiting on other futures from the future provided here will not
248+
/// perform as fast as those spawned as workers.
249+
///
243250
/// # Multi thread scheduler
244251
///
245252
/// When the multi thread scheduler is used this will allow futures

0 commit comments

Comments
 (0)