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.
This commit is contained in:
Carl Lerche
2017-11-01 07:28:49 -07:00
parent 697851210c
commit c6f1ff13d2
14 changed files with 117 additions and 186 deletions
+6 -1
View File
@@ -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));
}