pub fn spawn_blocking<F>(&self, task: F, name: &'static str)
    where
        F: FnOnce() -> () + Send + 'static,
    {
        let exit = self.exit.clone();
        let log = self.log.clone();
        let join_handle = self.handle.spawn_blocking(task);

        let future = future::select(join_handle, exit).then(move |either| {
            match either {
                future::Either::Left(_) => trace!(log, "Blocking task completed"; "task" => name),
                future::Either::Right(_) => {
                    debug!(log, "Blocking task shutdown, exit received"; "task" => name)
                }
            }
            futures::future::ready(())
        });
        self.handle.spawn(future);
    }
/// Spawn a blocking task on a dedicated tokio thread pool wrapped in an exit future.
Spawn a blocking task on a dedicated tokio thread pool wrapped in an exit future.
Spawn a blocking task on a dedicated tokio thread pool wrapped in an exit future .
pub fn spawn_blocking<F>(&self, task: F, name: &'static str)
    where
        F: FnOnce() -> () + Send + 'static,
    {
        let exit = self.exit.clone();
        let log = self.log.clone();
        let join_handle = self.handle.spawn_blocking(task);
        let future = future::select(join_handle, exit).then(move |either| {
            match either {
                future::Either::Left(_) => trace!(log, "Blocking task completed"; "task" => name),
                future::Either::Right(_) => {
                    debug!(log, "Blocking task shutdown, exit received"; "task" => name)
                }
            }
            futures::future::ready(())
        });
        self.handle.spawn(future);
    }
pub fn spawn_blocking < F > ( & self , task : F , name : & ' static str ) where F : FnOnce ( ) -> ( ) + Send + ' static , { let exit = self . exit . clone ( ) ; let log = self . log . clone ( ) ; let join_handle = self . handle . spawn_blocking ( task ) ; let future = future :: select ( join_handle , exit ) . then ( move | either | { match either { future :: Either :: Left ( _ ) => trace ! ( log " " " " name ) , future :: Either :: Right ( _ ) => { debug ! ( log " " " " name ) } } futures :: future :: ready ( ( ) ) } ) ; self . handle . spawn ( future ) ; }
Spawn a blocking task on a dedicated tokio thread pool wrapped in an exit future.
Spawn a blocking task on a dedicated tokio thread pool wrapped in an exit future .
&self
task
F
name
&'static str
&self
task
F
name
&'static str