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 mod schedule; 10 mod shutdown; 11 mod task; 12 pub(crate) use schedule::NoopSchedule; 13 pub(crate) use task::BlockingTask; 14 15 use crate::runtime::Builder; 16 create_blocking_pool(builder: &Builder, thread_cap: usize) -> BlockingPool17pub(crate) fn create_blocking_pool(builder: &Builder, thread_cap: usize) -> BlockingPool { 18 BlockingPool::new(builder, thread_cap) 19 } 20 21 /* 22 cfg_not_blocking_impl! { 23 use crate::runtime::Builder; 24 use std::time::Duration; 25 26 #[derive(Debug, Clone)] 27 pub(crate) struct BlockingPool {} 28 29 pub(crate) use BlockingPool as Spawner; 30 31 pub(crate) fn create_blocking_pool(_builder: &Builder, _thread_cap: usize) -> BlockingPool { 32 BlockingPool {} 33 } 34 35 impl BlockingPool { 36 pub(crate) fn spawner(&self) -> &BlockingPool { 37 self 38 } 39 40 pub(crate) fn shutdown(&mut self, _duration: Option<Duration>) { 41 } 42 } 43 } 44 */ 45