From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- .../rust/tokio-threadpool/examples/hello.rs | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 third_party/rust/tokio-threadpool/examples/hello.rs (limited to 'third_party/rust/tokio-threadpool/examples/hello.rs') diff --git a/third_party/rust/tokio-threadpool/examples/hello.rs b/third_party/rust/tokio-threadpool/examples/hello.rs new file mode 100644 index 0000000000..87eb688c2d --- /dev/null +++ b/third_party/rust/tokio-threadpool/examples/hello.rs @@ -0,0 +1,24 @@ +extern crate env_logger; +extern crate futures; +extern crate tokio_threadpool; + +use futures::sync::oneshot; +use futures::*; +use tokio_threadpool::*; + +pub fn main() { + let _ = ::env_logger::init(); + + let pool = ThreadPool::new(); + let tx = pool.sender().clone(); + + let res = oneshot::spawn( + future::lazy(|| { + println!("Running on the pool"); + Ok::<_, ()>("complete") + }), + &tx, + ); + + println!("Result: {:?}", res.wait()); +} -- cgit v1.2.3