Update Tokio to Rust 2018 (#1082)

This commit is contained in:
Carl Lerche
2019-05-14 10:27:36 -07:00
committed by GitHub
parent 79d8820050
commit cb4aea394e
343 changed files with 1725 additions and 2813 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
use park::DefaultPark;
use worker::WorkerId;
use crate::park::DefaultPark;
use crate::worker::WorkerId;
use std::cell::UnsafeCell;
use std::fmt;
@@ -298,7 +298,7 @@ impl From<State> for usize {
}
impl fmt::Debug for State {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("backup::State")
.field("is_pushed", &self.is_pushed())
.field("is_running", &self.is_running())
+1 -1
View File
@@ -1,4 +1,4 @@
use pool::{Backup, BackupId};
use crate::pool::{Backup, BackupId};
use std::sync::atomic::AtomicUsize;
use std::sync::atomic::Ordering::{AcqRel, Acquire};
+11 -13
View File
@@ -9,13 +9,15 @@ pub(crate) use self::state::{Lifecycle, State, MAX_FUTURES};
use self::backup::Handoff;
use self::backup_stack::BackupStack;
use config::Config;
use shutdown::ShutdownTrigger;
use task::{Blocking, Task};
use worker::{self, Worker, WorkerId};
use crate::config::Config;
use crate::shutdown::ShutdownTrigger;
use crate::task::{Blocking, Task};
use crate::worker::{self, Worker, WorkerId};
use crossbeam_deque::Injector;
use crossbeam_utils::CachePadded;
use futures::Poll;
use log::{debug, error, trace};
use rand;
use std::cell::Cell;
use std::num::Wrapping;
use std::sync::atomic::AtomicUsize;
@@ -23,10 +25,6 @@ use std::sync::atomic::Ordering::{AcqRel, Acquire};
use std::sync::{Arc, Weak};
use std::thread;
use crossbeam_deque::Injector;
use crossbeam_utils::CachePadded;
use rand;
#[derive(Debug)]
pub(crate) struct Pool {
// Tracks the state of the thread pool (running, shutting down, ...).
@@ -202,7 +200,7 @@ impl Pool {
}
pub fn terminate_sleeping_workers(&self) {
use worker::Lifecycle::Signaled;
use crate::worker::Lifecycle::Signaled;
trace!(" -> shutting down workers");
// Wakeup all sleeping workers. They will wake up, see the state
@@ -221,7 +219,7 @@ impl Pool {
}
}
pub fn poll_blocking_capacity(&self, task: &Arc<Task>) -> Poll<(), ::BlockingError> {
pub fn poll_blocking_capacity(&self, task: &Arc<Task>) -> Poll<(), crate::BlockingError> {
self.blocking.poll_blocking_capacity(task)
}
@@ -395,7 +393,7 @@ impl Pool {
pub fn signal_work(&self, pool: &Arc<Pool>) {
debug_assert_eq!(*self, **pool);
use worker::Lifecycle::Signaled;
use crate::worker::Lifecycle::Signaled;
if let Some((idx, worker_state)) = self.sleep_stack.pop(&self.workers, Signaled, false) {
let entry = &self.workers[idx];
+1 -1
View File
@@ -99,7 +99,7 @@ impl From<State> for usize {
}
impl fmt::Debug for State {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("pool::State")
.field("lifecycle", &self.lifecycle())
.field("num_futures", &self.num_futures())