Migrate threadpool to futures-util (#1403)

* Migrate threadpool to futures-util

Signed-off-by: Lucio Franco <[email protected]>

* fmt
This commit is contained in:
Lucio Franco
2019-08-07 16:26:44 -04:00
committed by GitHub
parent 6412389bba
commit 7268b0bb3a
10 changed files with 14 additions and 15 deletions
+3 -3
View File
@@ -25,9 +25,9 @@ publish = false
[dependencies]
tokio-executor = { version = "0.2.0", path = "../tokio-executor" }
tokio-sync = { version = "0.2.0", path = "../tokio-sync" }
futures-core-preview = "0.3.0-alpha.17"
futures-core-preview = "= 0.3.0-alpha.17"
futures-util-preview = "= 0.3.0-alpha.17"
arc-waker = { git = "https://github.com/tokio-rs/async" }
crossbeam-deque = "0.7.0"
crossbeam-queue = "0.1.0"
crossbeam-utils = "0.6.4"
@@ -39,6 +39,6 @@ lazy_static = "1"
[dev-dependencies]
rand = "0.7"
env_logger = "0.5"
async-util = { git = "https://github.com/tokio-rs/async" }
tokio = { version = "0.2.0", path = "../tokio" }
tokio-test = { version = "0.2.0", path = "../tokio-test" }
futures-util-preview = "= 0.3.0-alpha.17"
+2 -1
View File
@@ -8,6 +8,7 @@ use self::state::State;
use crate::pool::Pool;
use crate::waker::Waker;
use futures_util::task::ArcWake;
use log::trace;
use std::cell::{Cell, UnsafeCell};
use std::future::Future;
@@ -134,7 +135,7 @@ impl Task {
let mut g = Guard(fut, true);
let waker = arc_waker::waker(Arc::new(Waker {
let waker = ArcWake::into_waker(Arc::new(Waker {
task: me.clone(),
pool: pool.clone(),
}));
+2 -2
View File
@@ -1,7 +1,7 @@
use crate::pool::Pool;
use crate::task::Task;
use arc_waker::Wake;
use futures_util::task::ArcWake;
use std::sync::Arc;
/// Implements the future `Waker` API.
@@ -17,7 +17,7 @@ pub(crate) struct Waker {
unsafe impl Send for Waker {}
unsafe impl Sync for Waker {}
impl Wake for Waker {
impl ArcWake for Waker {
fn wake_by_ref(me: &Arc<Self>) {
Task::schedule(&me.task, &me.pool);
}
+1 -1
View File
@@ -4,8 +4,8 @@
use tokio_test::*;
use tokio_threadpool::*;
use async_util::future::poll_fn;
use futures_core::ready;
use futures_util::future::poll_fn;
use rand::*;
use std::sync::atomic::Ordering::*;
use std::sync::atomic::*;