File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -431,13 +431,19 @@ impl State {
431
431
}
432
432
433
433
pub async fn run < T > ( & self , future : impl Future < Output = T > ) -> T {
434
- let mut ticker = Ticker :: new ( self ) ;
435
-
436
434
// A future that runs tasks forever.
437
435
let run_forever = async {
438
436
loop {
439
437
for _ in 0 ..200 {
440
- ticker. runnable ( ) . await . run ( ) ;
438
+ // SAFETY: All UnsafeCell accesses to queue are tightly scoped, and because
439
+ // `LocalExecutor` is !Send, there is no way to have concurrent access to the
440
+ // values in `State`, including the queue field.
441
+ match unsafe { & mut * self . queue . get ( ) } . pop_back ( ) {
442
+ Some ( runnable) => {
443
+ runnable. run ( ) ;
444
+ } ,
445
+ None => break ,
446
+ }
441
447
}
442
448
future:: yield_now ( ) . await ;
443
449
}
You can’t perform that action at this time.
0 commit comments