@@ -2,7 +2,6 @@ use crate::{PlatformDispatcher, TaskLabel};
22use async_task:: Runnable ;
33use backtrace:: Backtrace ;
44use collections:: { HashMap , HashSet , VecDeque } ;
5- use parking:: { Parker , Unparker } ;
65use parking_lot:: Mutex ;
76use rand:: prelude:: * ;
87use std:: {
@@ -22,8 +21,6 @@ struct TestDispatcherId(usize);
2221pub struct TestDispatcher {
2322 id : TestDispatcherId ,
2423 state : Arc < Mutex < TestDispatcherState > > ,
25- parker : Arc < Mutex < Parker > > ,
26- unparker : Unparker ,
2724}
2825
2926struct TestDispatcherState {
@@ -45,7 +42,6 @@ struct TestDispatcherState {
4542
4643impl TestDispatcher {
4744 pub fn new ( random : StdRng ) -> Self {
48- let ( parker, unparker) = parking:: pair ( ) ;
4945 let state = TestDispatcherState {
5046 random,
5147 foreground : HashMap :: default ( ) ,
@@ -66,8 +62,6 @@ impl TestDispatcher {
6662 TestDispatcher {
6763 id : TestDispatcherId ( 0 ) ,
6864 state : Arc :: new ( Mutex :: new ( state) ) ,
69- parker : Arc :: new ( Mutex :: new ( parker) ) ,
70- unparker,
7165 }
7266 }
7367
@@ -251,8 +245,6 @@ impl Clone for TestDispatcher {
251245 Self {
252246 id : TestDispatcherId ( id) ,
253247 state : self . state . clone ( ) ,
254- parker : self . parker . clone ( ) ,
255- unparker : self . unparker . clone ( ) ,
256248 }
257249 }
258250}
@@ -276,7 +268,6 @@ impl PlatformDispatcher for TestDispatcher {
276268 state. background . push ( runnable) ;
277269 }
278270 }
279- self . unparker . unpark ( ) ;
280271 }
281272
282273 fn dispatch_on_main_thread ( & self , runnable : Runnable ) {
@@ -286,7 +277,6 @@ impl PlatformDispatcher for TestDispatcher {
286277 . entry ( self . id )
287278 . or_default ( )
288279 . push_back ( runnable) ;
289- self . unparker . unpark ( ) ;
290280 }
291281
292282 fn dispatch_after ( & self , duration : std:: time:: Duration , runnable : Runnable ) {
@@ -297,14 +287,6 @@ impl PlatformDispatcher for TestDispatcher {
297287 } ;
298288 state. delayed . insert ( ix, ( next_time, runnable) ) ;
299289 }
300- fn park ( & self , _: Option < std:: time:: Duration > ) -> bool {
301- self . parker . lock ( ) . park ( ) ;
302- true
303- }
304-
305- fn unparker ( & self ) -> Unparker {
306- self . unparker . clone ( )
307- }
308290
309291 fn as_test ( & self ) -> Option < & TestDispatcher > {
310292 Some ( self )
0 commit comments