Skip to content

Commit f5f2b58

Browse files
authored
rt: improve docs for Builder::max_blocking_threads (#5793)
Closes #5777
1 parent 718dcc8 commit f5f2b58

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

tokio/src/runtime/builder.rs

+16-3
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,17 @@ impl Builder {
404404
/// Specifies the limit for additional threads spawned by the Runtime.
405405
///
406406
/// These threads are used for blocking operations like tasks spawned
407-
/// through [`spawn_blocking`]. Unlike the [`worker_threads`], they are not
408-
/// always active and will exit if left idle for too long. You can change
409-
/// this timeout duration with [`thread_keep_alive`].
407+
/// through [`spawn_blocking`], this includes but is not limited to:
408+
/// - [`fs`] operations
409+
/// - dns resolution through [`ToSocketAddrs`]
410+
/// - writing to [`Stdout`] or [`Stderr`]
411+
/// - reading from [`Stdin`]
412+
///
413+
/// Unlike the [`worker_threads`], they are not always active and will exit
414+
/// if left idle for too long. You can change this timeout duration with [`thread_keep_alive`].
415+
///
416+
/// It's recommended to not set this limit too low in order to avoid hanging on operations
417+
/// requiring [`spawn_blocking`].
410418
///
411419
/// The default value is 512.
412420
///
@@ -420,6 +428,11 @@ impl Builder {
420428
/// current `max_blocking_threads` does not include async worker threads in the count.
421429
///
422430
/// [`spawn_blocking`]: fn@crate::task::spawn_blocking
431+
/// [`fs`]: mod@crate::fs
432+
/// [`ToSocketAddrs`]: trait@crate::net::ToSocketAddrs
433+
/// [`Stdout`]: struct@crate::io::Stdout
434+
/// [`Stdin`]: struct@crate::io::Stdin
435+
/// [`Stderr`]: struct@crate::io::Stderr
423436
/// [`worker_threads`]: Self::worker_threads
424437
/// [`thread_keep_alive`]: Self::thread_keep_alive
425438
#[track_caller]

0 commit comments

Comments
 (0)