1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-23 21:51:06 +01:00

use parking_lot 0.10

This commit is contained in:
Nikolay Kim 2019-12-12 06:57:40 +06:00
parent 33fd6adc11
commit 37bedff6fb
3 changed files with 17 additions and 8 deletions

View File

@ -1,5 +1,11 @@
# Changes
## [0.3.1] - 2019-12-12
### Changed
* Use parking_lot 0.10
## [0.3.0] - 2019-12-02
### Changed

View File

@ -1,6 +1,6 @@
[package]
name = "actix-threadpool"
version = "0.3.0"
version = "0.3.1"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
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"

View File

@ -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<I, E: fmt::Debug> Future for CpuFuture<I, E> {
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
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)
}
}