summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2018-06-12 14:41:12 -0700
committerGitHub <noreply@github.com>2018-06-12 14:41:12 -0700
commitab07733d665a8e086c91cc7cb993ae2afcca4be2 (patch)
treee3aa126171bbf1639958231c8ee48062a80183cf
parentd1f825ca1319897e2429380fb651758c79930fc2 (diff)
Deprecate executor re-exports (#412)
-rw-r--r--benches/tcp.rs1
-rw-r--r--examples/manual-runtime.rs11
-rw-r--r--src/executor/mod.rs32
-rw-r--r--src/runtime/current_thread/runtime.rs4
4 files changed, 21 insertions, 27 deletions
diff --git a/benches/tcp.rs b/benches/tcp.rs
index 45ff3711..fde72ce0 100644
--- a/benches/tcp.rs
+++ b/benches/tcp.rs
@@ -13,7 +13,6 @@ mod prelude {
pub use futures::*;
pub use tokio::reactor::Reactor;
pub use tokio::net::{TcpListener, TcpStream};
- pub use tokio::executor::current_thread;
pub use tokio_io::io::read_to_end;
pub use test::{self, Bencher};
diff --git a/examples/manual-runtime.rs b/examples/manual-runtime.rs
index bad74851..6cbb8cd4 100644
--- a/examples/manual-runtime.rs
+++ b/examples/manual-runtime.rs
@@ -10,6 +10,7 @@
extern crate futures;
extern crate tokio;
+extern crate tokio_current_thread;
extern crate tokio_executor;
extern crate tokio_reactor;
extern crate tokio_timer;
@@ -18,11 +19,11 @@ use std::io::Error as IoError;
use std::time::{Duration, Instant};
use futures::{future, Future};
-use tokio::executor::current_thread::{self, CurrentThread};
+use tokio_current_thread::CurrentThread;
use tokio_reactor::Reactor;
use tokio_timer::timer::{self, Timer};
-/// Creates a „runtime“.
+/// Creates a "runtime".
///
/// This is similar to running `tokio::runtime::current_thread::Runtime::new()`.
fn run<F: Future<Item = (), Error = ()>>(f: F) -> Result<(), IoError> {
@@ -46,7 +47,7 @@ fn run<F: Future<Item = (), Error = ()>>(f: F) -> Result<(), IoError> {
// executor when used. This is a trick, because we need two mutable references to the
// executor (one to run the provided future, another to install as the default one). We
// use the fake one here as the default one.
- let mut default_executor = current_thread::TaskExecutor::current();
+ let mut default_executor = tokio_current_thread::TaskExecutor::current();
tokio_executor::with_default(&mut default_executor, enter, |enter| {
let mut executor = executor.enter(enter);
// Run the provided future
@@ -61,7 +62,7 @@ fn run<F: Future<Item = (), Error = ()>>(f: F) -> Result<(), IoError> {
fn main() {
run(future::lazy(|| {
- // Here comes the application logic. It can spawn further tasks by current_thread::spawn().
+ // Here comes the application logic. It can spawn further tasks by tokio_current_thread::spawn().
// It also can use the default reactor and create timeouts.
// Connect somewhere. And then do nothing with it. Yes, useless.
@@ -72,7 +73,7 @@ fn main() {
.map_err(|e| println!("Failed to connect: {}", e));
// We can spawn it without requiring Send. This would panic if we run it outside of the
// `run` (or outside of anything else)
- current_thread::spawn(connect);
+ tokio_current_thread::spawn(connect);
// We can also create timeouts.
let deadline = tokio::timer::Delay::new(Instant::now() + Duration::from_secs(5))
diff --git a/src/executor/mod.rs b/src/executor/mod.rs
index 8733f178..8e62bc54 100644
--- a/src/executor/mod.rs
+++ b/src/executor/mod.rs
@@ -13,16 +13,8 @@
//!
//! The specific strategy used to manage the tasks is left up to the
//! executor. There are two main flavors of executors: single-threaded and
-//! multithreaded. This module provides both.
-//!
-//! * **[`current_thread`]**: A single-threaded executor that support spawning
-//! tasks that are not `Send`. It guarantees that tasks will be executed on
-//! the same thread from which they are spawned.
-//!
-//! * **[`thread_pool`]**: A multi-threaded executor that maintains a pool of
-//! threads. Tasks are spawned to one of the threads in the pool and executed.
-//! The pool employs a [work-stealing] strategy for optimizing how tasks get
-//! spread across the available threads.
+//! multithreaded. Tokio provides implementation for both of these in the
+//! [`runtime`] module.
//!
//! # `Executor` trait.
//!
@@ -36,21 +28,23 @@
//! executor. This value will often be set to the executor itself, but it is
//! possible that the default executor might be set to a different executor.
//!
-//! For example, the [`current_thread`] executor might set the default executor
-//! to a thread pool instead of itself, allowing futures to spawn new tasks onto
-//! the thread pool when those tasks are `Send`.
+//! For example, a single threaded executor might set the default executor to a
+//! thread pool instead of itself, allowing futures to spawn new tasks onto the
+//! thread pool when those tasks are `Send`.
//!
//! [`Future::poll`]: https://docs.rs/futures/0.1/futures/future/trait.Future.html#tymethod.poll
//! [notified]: https://docs.rs/futures/0.1/futures/executor/trait.Notify.html#tymethod.notify
-//! [`current_thread`]: current_thread/index.html
-//! [`thread_pool`]: thread_pool/index.html
-//! [work-stealing]: https://en.wikipedia.org/wiki/Work_stealing
-//! [`tokio-executor`]: #
-//! [`Executor`]: #
-//! [`spawn`]: #
+//! [`runtime`]: ../runtime/index.html
+//! [`tokio-executor`]: https://docs.rs/tokio-executor/0.1
+//! [`Executor`]: trait.Executor.html
+//! [`spawn`]: fn.spawn.html
+#[deprecated(since = "0.1.8", note = "use tokio-current-thread crate instead")]
+#[doc(hidden)]
pub mod current_thread;
+#[deprecated(since = "0.1.8", note = "use tokio-threadpool crate instead")]
+#[doc(hidden)]
pub mod thread_pool {
//! Maintains a pool of threads across which the set of spawned tasks are
//! executed.
diff --git a/src/runtime/current_thread/runtime.rs b/src/runtime/current_thread/runtime.rs
index 8939f08c..365c27fa 100644
--- a/src/runtime/current_thread/runtime.rs
+++ b/src/runtime/current_thread/runtime.rs
@@ -1,5 +1,5 @@
-use executor::current_thread::{self, CurrentThread};
-use executor::current_thread::Handle as ExecutorHandle;
+use tokio_current_thread::{self as current_thread, CurrentThread};
+use tokio_current_thread::Handle as ExecutorHandle;
use runtime::current_thread::Builder;
use tokio_reactor::{self, Reactor};