From c6f1ff13d249a42a5d0ae716dffca6a22cd1d7ca Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Wed, 25 Oct 2017 10:54:54 -0700 Subject: Remove executor from reactor. In accordance with tokio-rs/tokio-rfcs#3, the executor functionality of Tokio is being removed and will be relocated into futures-rs as a "current thread" executor. This PR removes task execution from the code base. As a temporary mesure, all examples and tests are switched to using CpuPool. Depends on #19. --- examples/udp-codec.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'examples/udp-codec.rs') diff --git a/examples/udp-codec.rs b/examples/udp-codec.rs index 4066060e..65a522ca 100644 --- a/examples/udp-codec.rs +++ b/examples/udp-codec.rs @@ -9,11 +9,14 @@ extern crate tokio; extern crate env_logger; extern crate futures; +extern crate futures_cpupool; use std::io; use std::net::SocketAddr; use futures::{Future, Stream, Sink}; +use futures::future::Executor; +use futures_cpupool::CpuPool; use tokio::net::{UdpSocket, UdpCodec}; use tokio::reactor::Core; @@ -39,6 +42,8 @@ fn main() { let mut core = Core::new().unwrap(); let handle = core.handle(); + let pool = CpuPool::new(1); + let addr: SocketAddr = "127.0.0.1:0".parse().unwrap(); // Bind both our sockets and then figure out what ports we got. @@ -73,6 +78,6 @@ fn main() { let b = b_sink.send_all(b_stream); // Spawn the sender of pongs and then wait for our pinger to finish. - handle.spawn(b.then(|_| Ok(()))); + pool.execute(b.then(|_| Ok(()))).unwrap(); drop(core.run(a)); } -- cgit v1.2.3