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