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
@@ -17,6 +17,7 @@
//! the echo server, and you'll be able to see data flowing between them.
extern crate futures;
extern crate futures_cpupool;
extern crate tokio;
extern crate tokio_io;
@@ -27,6 +28,8 @@ use std::io::{self, Read, Write};
use futures::stream::Stream;
use futures::{Future, Poll};
use futures::future::Executor;
use futures_cpupool::CpuPool;
use tokio::net::{TcpListener, TcpStream};
use tokio::reactor::Core;
use tokio_io::{AsyncRead, AsyncWrite};
@@ -43,6 +46,8 @@ fn main() {
let mut l = Core::new().unwrap();
let handle = l.handle();
let pool = CpuPool::new(1);
// Create a TCP listener which will listen for incoming connections.
let socket = TcpListener::bind(&listen_addr, &l.handle()).unwrap();
println!("Listening on: {}", listen_addr);
@@ -88,7 +93,7 @@ fn main() {
// Don't panic. Maybe the client just disconnected too soon.
println!("error: {}", e);
});
handle.spawn(msg);
pool.execute(msg).unwrap();
Ok(())
});