| 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 | |
| 6 | mod pool; |
| 7 | pub(crate) use pool::{spawn_blocking, BlockingPool, Spawner}; |
| 8 | |
| 9 | cfg_fs! { |
| 10 | pub(crate) use pool::spawn_mandatory_blocking; |
| 11 | } |
| 12 | |
| 13 | cfg_trace! { |
| 14 | pub(crate) use pool::Mandatory; |
| 15 | } |
| 16 | |
| 17 | mod schedule; |
| 18 | mod shutdown; |
| 19 | mod task; |
| 20 | pub(crate) use task::BlockingTask; |
| 21 | |
| 22 | use crate::runtime::Builder; |
| 23 | |
| 24 | pub(crate) fn create_blocking_pool(builder: &Builder, thread_cap: usize) -> BlockingPool { |
| 25 | BlockingPool::new(builder, thread_cap) |
| 26 | } |
| 27 | |