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
+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);
}