mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +00:00
docs: mention blocking thread timeout in src/lib.rs (#3253)
This commit is contained in:
parent
4c55419453
commit
9149d7bfae
@ -173,16 +173,18 @@
|
|||||||
//! combat this, Tokio provides two kinds of threads: Core threads and blocking
|
//! combat this, Tokio provides two kinds of threads: Core threads and blocking
|
||||||
//! threads. The core threads are where all asynchronous code runs, and Tokio
|
//! threads. The core threads are where all asynchronous code runs, and Tokio
|
||||||
//! will by default spawn one for each CPU core. The blocking threads are
|
//! will by default spawn one for each CPU core. The blocking threads are
|
||||||
//! spawned on demand, and can be used to run blocking code that would otherwise
|
//! spawned on demand, can be used to run blocking code that would otherwise
|
||||||
//! block other tasks from running. Since it is not possible for Tokio to swap
|
//! block other tasks from running and are kept alive when not used for a certain
|
||||||
//! out blocking tasks, like it can do with asynchronous code, the upper limit
|
//! amount of time which can be configured with [`thread_keep_alive`].
|
||||||
//! on the number of blocking threads is very large. These limits can be
|
//! Since it is not possible for Tokio to swap out blocking tasks, like it
|
||||||
//! configured on the [`Builder`].
|
//! can do with asynchronous code, the upper limit on the number of blocking
|
||||||
|
//! threads is very large. These limits can be configured on the [`Builder`].
|
||||||
//!
|
//!
|
||||||
//! To spawn a blocking task, you should use the [`spawn_blocking`] function.
|
//! To spawn a blocking task, you should use the [`spawn_blocking`] function.
|
||||||
//!
|
//!
|
||||||
//! [`Builder`]: crate::runtime::Builder
|
//! [`Builder`]: crate::runtime::Builder
|
||||||
//! [`spawn_blocking`]: crate::task::spawn_blocking()
|
//! [`spawn_blocking`]: crate::task::spawn_blocking()
|
||||||
|
//! [`thread_keep_alive`]: crate::runtime::Builder::thread_keep_alive()
|
||||||
//!
|
//!
|
||||||
//! ```
|
//! ```
|
||||||
//! #[tokio::main]
|
//! #[tokio::main]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user