rt: improve docs for Builder::max_blocking_threads (#5793)

Closes #5777
This commit is contained in:
Marek Kuskowski 2023-08-16 21:12:53 +02:00 committed by GitHub
parent 718dcc8dff
commit f5f2b58b8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -404,9 +404,17 @@ impl Builder {
/// Specifies the limit for additional threads spawned by the Runtime.
///
/// These threads are used for blocking operations like tasks spawned
/// through [`spawn_blocking`]. Unlike the [`worker_threads`], they are not
/// always active and will exit if left idle for too long. You can change
/// this timeout duration with [`thread_keep_alive`].
/// through [`spawn_blocking`], this includes but is not limited to:
/// - [`fs`] operations
/// - dns resolution through [`ToSocketAddrs`]
/// - writing to [`Stdout`] or [`Stderr`]
/// - reading from [`Stdin`]
///
/// Unlike the [`worker_threads`], they are not always active and will exit
/// if left idle for too long. You can change this timeout duration with [`thread_keep_alive`].
///
/// It's recommended to not set this limit too low in order to avoid hanging on operations
/// requiring [`spawn_blocking`].
///
/// The default value is 512.
///
@ -420,6 +428,11 @@ impl Builder {
/// current `max_blocking_threads` does not include async worker threads in the count.
///
/// [`spawn_blocking`]: fn@crate::task::spawn_blocking
/// [`fs`]: mod@crate::fs
/// [`ToSocketAddrs`]: trait@crate::net::ToSocketAddrs
/// [`Stdout`]: struct@crate::io::Stdout
/// [`Stdin`]: struct@crate::io::Stdin
/// [`Stderr`]: struct@crate::io::Stderr
/// [`worker_threads`]: Self::worker_threads
/// [`thread_keep_alive`]: Self::thread_keep_alive
#[track_caller]