Skip to main content

tokio/runtime/blocking/
mod.rs

1//! Abstracts out the APIs necessary to `Runtime` for integrating the blocking
2//! pool. When the `blocking` feature flag is **not** enabled, these APIs are
3//! shells. This isolates the complexity of dealing with conditional
4//! compilation.
5
6mod pool;
7pub(crate) use pool::{spawn_blocking, BlockingPool, Spawner};
8
9mod sharded;
10
11cfg_io_blocking! {
12    pub(crate) use pool::spawn_mandatory_blocking;
13}
14
15cfg_trace! {
16    pub(crate) use pool::Mandatory;
17}
18
19mod schedule;
20mod shutdown;
21mod task;
22pub(crate) use task::BlockingTask;
23
24use crate::runtime::Builder;
25
26pub(crate) fn create_blocking_pool(
27    builder: &Builder,
28    thread_cap: usize,
29    scheduler_threads: usize,
30) -> BlockingPool {
31    BlockingPool::new(builder, thread_cap, scheduler_threads)
32}