File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 3
3
extern crate test;
4
4
5
5
use async_std:: task;
6
- use async_std:: task_local ;
7
- use test :: { black_box , Bencher } ;
6
+ use async_std:: task :: blocking :: JoinHandle ;
7
+ use futures :: future :: join_all ;
8
8
use std:: thread;
9
9
use std:: time:: Duration ;
10
- use async_std:: task:: blocking:: JoinHandle ;
11
- use futures:: future:: { join_all} ;
12
-
10
+ use test:: Bencher ;
13
11
14
12
#[ bench]
15
13
fn blocking ( b : & mut Bencher ) {
16
14
b. iter ( || {
17
- let handles = ( 0 ..10_000 ) . map ( |_| {
18
- task:: blocking:: spawn ( async {
19
- let duration = Duration :: from_millis ( 1 ) ;
20
- thread:: sleep ( duration) ;
15
+ let handles = ( 0 ..10_000 )
16
+ . map ( |_| {
17
+ task:: blocking:: spawn ( async {
18
+ let duration = Duration :: from_millis ( 1 ) ;
19
+ thread:: sleep ( duration) ;
20
+ } )
21
21
} )
22
- } ) . collect :: < Vec < JoinHandle < ( ) > > > ( ) ;
22
+ . collect :: < Vec < JoinHandle < ( ) > > > ( ) ;
23
23
24
24
task:: block_on ( join_all ( handles) ) ;
25
25
} ) ;
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ static CURRENT_POOL_SIZE: AtomicU64 = AtomicU64::new(LOW_WATERMARK);
29
29
30
30
struct Pool {
31
31
sender : Sender < async_task:: Task < ( ) > > ,
32
- receiver : Receiver < async_task:: Task < ( ) > >
32
+ receiver : Receiver < async_task:: Task < ( ) > > ,
33
33
}
34
34
35
35
lazy_static ! {
You can’t perform that action at this time.
0 commit comments