diff options
Diffstat (limited to 'tokio/src/blocking/pool.rs')
-rw-r--r-- | tokio/src/blocking/pool.rs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/tokio/src/blocking/pool.rs b/tokio/src/blocking/pool.rs index fccfc18e..f75af780 100644 --- a/tokio/src/blocking/pool.rs +++ b/tokio/src/blocking/pool.rs @@ -116,16 +116,20 @@ impl fmt::Debug for BlockingPool { // ===== impl Spawner ===== -impl Spawner { - #[cfg(feature = "rt-full")] - pub(crate) fn spawn_background<F>(&self, func: F) - where - F: FnOnce() + Send + 'static, - { - let task = task::background(BlockingTask::new(func)); - self.schedule(task); + +cfg_rt_threaded! { + impl Spawner { + pub(crate) fn spawn_background<F>(&self, func: F) + where + F: FnOnce() + Send + 'static, + { + let task = task::background(BlockingTask::new(func)); + self.schedule(task); + } } +} +impl Spawner { /// Set the blocking pool for the duration of the closure /// /// If a blocking pool is already set, it will be restored when the closure |