mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-25 00:00:18 +02:00
Update Tokio to Rust 2018 (#1082)
This commit is contained in:
@@ -1,24 +1,21 @@
|
||||
extern crate env_logger;
|
||||
extern crate futures;
|
||||
extern crate tokio_executor;
|
||||
extern crate tokio_threadpool;
|
||||
|
||||
use tokio_executor::park::{Park, Unpark};
|
||||
use tokio_threadpool::park::{DefaultPark, DefaultUnpark};
|
||||
use tokio_threadpool::*;
|
||||
#![deny(warnings, rust_2018_idioms)]
|
||||
|
||||
use futures::future::lazy;
|
||||
use futures::{Async, Future, Poll, Sink, Stream};
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::sync::atomic::Ordering::Relaxed;
|
||||
use std::sync::atomic::*;
|
||||
use std::sync::{mpsc, Arc};
|
||||
use std::time::Duration;
|
||||
use tokio_executor::park::{Park, Unpark};
|
||||
use tokio_threadpool::park::{DefaultPark, DefaultUnpark};
|
||||
use tokio_threadpool::*;
|
||||
|
||||
thread_local!(static FOO: Cell<u32> = Cell::new(0));
|
||||
|
||||
fn ignore_results<F: Future + Send + 'static>(f: F) -> Box<Future<Item = (), Error = ()> + Send> {
|
||||
fn ignore_results<F: Future + Send + 'static>(
|
||||
f: F,
|
||||
) -> Box<dyn Future<Item = (), Error = ()> + Send> {
|
||||
Box::new(f.map(|_| ()).map_err(|_| ()))
|
||||
}
|
||||
|
||||
@@ -129,7 +126,7 @@ fn force_shutdown_drops_futures() {
|
||||
b.fetch_add(1, Relaxed);
|
||||
})
|
||||
.build();
|
||||
let mut tx = pool.sender().clone();
|
||||
let tx = pool.sender().clone();
|
||||
|
||||
tx.spawn(Never(num_drop.clone())).unwrap();
|
||||
|
||||
@@ -188,7 +185,7 @@ fn drop_threadpool_drops_futures() {
|
||||
b.fetch_add(1, Relaxed);
|
||||
})
|
||||
.build();
|
||||
let mut tx = pool.sender().clone();
|
||||
let tx = pool.sender().clone();
|
||||
|
||||
tx.spawn(Never(num_drop.clone())).unwrap();
|
||||
|
||||
@@ -217,7 +214,7 @@ fn many_oneshot_futures() {
|
||||
|
||||
for _ in 0..50 {
|
||||
let pool = ThreadPool::new();
|
||||
let mut tx = pool.sender().clone();
|
||||
let tx = pool.sender().clone();
|
||||
let cnt = Arc::new(AtomicUsize::new(0));
|
||||
|
||||
for _ in 0..NUM {
|
||||
@@ -249,7 +246,7 @@ fn many_multishot_futures() {
|
||||
|
||||
for _ in 0..50 {
|
||||
let pool = ThreadPool::new();
|
||||
let mut pool_tx = pool.sender().clone();
|
||||
let pool_tx = pool.sender().clone();
|
||||
|
||||
let mut start_txs = Vec::with_capacity(TRACKS);
|
||||
let mut final_rxs = Vec::with_capacity(TRACKS);
|
||||
|
||||
Reference in New Issue
Block a user