From 37bedff6fb3e4095bb1f3e28bb540b28f153906f Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Thu, 12 Dec 2019 06:57:40 +0600 Subject: [PATCH] use parking_lot 0.10 --- actix-threadpool/CHANGES.md | 6 ++++++ actix-threadpool/Cargo.toml | 8 ++++---- actix-threadpool/src/lib.rs | 11 +++++++---- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/actix-threadpool/CHANGES.md b/actix-threadpool/CHANGES.md index cce89692..dd10210f 100644 --- a/actix-threadpool/CHANGES.md +++ b/actix-threadpool/CHANGES.md @@ -1,5 +1,11 @@ # Changes +## [0.3.1] - 2019-12-12 + +### Changed + +* Use parking_lot 0.10 + ## [0.3.0] - 2019-12-02 ### Changed diff --git a/actix-threadpool/Cargo.toml b/actix-threadpool/Cargo.toml index 90fafda0..36f9acfb 100644 --- a/actix-threadpool/Cargo.toml +++ b/actix-threadpool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-threadpool" -version = "0.3.0" +version = "0.3.1" authors = ["Nikolay Kim "] description = "Actix thread pool for sync code" keywords = ["actix", "network", "framework", "async", "futures"] @@ -19,9 +19,9 @@ path = "src/lib.rs" [dependencies] derive_more = "0.99.2" -futures = "0.3.1" -parking_lot = "0.9" -lazy_static = "1.2" +futures-channel = "0.3.1" +parking_lot = "0.10" +lazy_static = "1.3" log = "0.4" num_cpus = "1.10" threadpool = "1.7" diff --git a/actix-threadpool/src/lib.rs b/actix-threadpool/src/lib.rs index ada9103b..beead547 100644 --- a/actix-threadpool/src/lib.rs +++ b/actix-threadpool/src/lib.rs @@ -6,7 +6,7 @@ use std::pin::Pin; use std::task::{Context, Poll}; use derive_more::Display; -use futures::channel::oneshot; +use futures_channel::oneshot; use parking_lot::Mutex; use threadpool::ThreadPool; @@ -79,9 +79,12 @@ impl Future for CpuFuture { fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let rx = Pin::new(&mut self.rx); - let res = futures::ready!(rx.poll(cx)) - .map_err(|_| BlockingError::Canceled) - .and_then(|res| res.map_err(BlockingError::Error)); + let res = match rx.poll(cx) { + Poll::Pending => return Poll::Pending, + Poll::Ready(res) => res + .map_err(|_| BlockingError::Canceled) + .and_then(|res| res.map_err(BlockingError::Error)), + }; Poll::Ready(res) } }