mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-24 00:00:11 +02:00
Migrate threadpool to futures-util (#1403)
* Migrate threadpool to futures-util Signed-off-by: Lucio Franco <[email protected]> * fmt
This commit is contained in:
@@ -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(),
|
||||
}));
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user