runtime: document the queue behavior of spawn_blocking (#7269)

This commit is contained in:
M.Amin Rayej 2025-04-17 22:49:29 +03:30 committed by GitHub
parent d41d49d202
commit ce87dcfbf0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -445,6 +445,15 @@ impl Builder {
///
/// The default value is 512.
///
/// # Queue Behavior
///
/// When a blocking task is submitted, it will be inserted into a queue. If available, one of
/// the idle threads will be notified to run the task. Otherwise, if the threshold set by this
/// method has not been reached, a new thread will be spawned. If no idle thread is available
/// and no more threads are allowed to be spawned, the task will remain in the queue until one
/// of the busy threads pick it up. Note that since the queue does not apply any backpressure,
/// it could potentially grow unbounded.
///
/// # Panics
///
/// This will panic if `val` is not larger than `0`.