Files
tokio/tokio-threadpool/examples/hello.rs
T

27 lines
515 B
Rust
Raw Normal View History

2019-06-30 08:48:53 -07:00
#![cfg(features = "broken")]
2019-02-21 11:56:15 -08:00
extern crate env_logger;
extern crate futures;
extern crate tokio_threadpool;
use futures::sync::oneshot;
2019-02-21 11:56:15 -08:00
use futures::*;
use tokio_threadpool::*;
pub fn main() {
let _ = ::env_logger::init();
let pool = ThreadPool::new();
let tx = pool.sender().clone();
2019-02-21 11:56:15 -08:00
let res = oneshot::spawn(
future::lazy(|| {
println!("Running on the pool");
Ok::<_, ()>("complete")
}),
&tx,
);
println!("Result: {:?}", res.wait());
}