mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-23 00:00:10 +02:00
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:
+6
-1
@@ -32,10 +32,13 @@
|
||||
//!
|
||||
//! ```no_run
|
||||
//! extern crate futures;
|
||||
//! extern crate futures_cpupool;
|
||||
//! extern crate tokio;
|
||||
//! extern crate tokio_io;
|
||||
//!
|
||||
//! use futures::{Future, Stream};
|
||||
//! use futures::future::Executor;
|
||||
//! use futures_cpupool::CpuPool;
|
||||
//! use tokio_io::AsyncRead;
|
||||
//! use tokio_io::io::copy;
|
||||
//! use tokio::net::TcpListener;
|
||||
@@ -46,6 +49,8 @@
|
||||
//! let mut core = Core::new().unwrap();
|
||||
//! let handle = core.handle();
|
||||
//!
|
||||
//! let pool = CpuPool::new_num_cpus();
|
||||
//!
|
||||
//! // Bind the server's socket
|
||||
//! let addr = "127.0.0.1:12345".parse().unwrap();
|
||||
//! let listener = TcpListener::bind(&addr, &handle).unwrap();
|
||||
@@ -68,7 +73,7 @@
|
||||
//! });
|
||||
//!
|
||||
//! // Spawn the future as a concurrent task
|
||||
//! handle.spawn(handle_conn);
|
||||
//! pool.execute(handle_conn).unwrap();
|
||||
//!
|
||||
//! Ok(())
|
||||
//! });
|
||||
|
||||
Reference in New Issue
Block a user