File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -730,6 +730,18 @@ fn lifo_stealable() {
730730 . unwrap ( ) ;
731731
732732 rt. block_on ( async {
733+ // Keep the runtime busy so that the workers that might steal the
734+ // blocked task don't all park themselves forever.
735+ //
736+ // Since this task will always be woken by whichever worker is holding
737+ // the time driver, rather than a worker that's executing tasks, it
738+ // shouldn't ever kick the victim task out of its worker's LIFO slot.
739+ let churn = tokio:: spawn ( async move {
740+ loop {
741+ tokio:: time:: sleep ( Duration :: from_millis ( 4 ) ) . await ;
742+ }
743+ } ) ;
744+
733745 let victim_task_joined = tokio:: spawn ( async move {
734746 println ! ( "[victim] task started" ) ;
735747 task_started_tx. send ( ( ) ) . unwrap ( ) ;
@@ -779,6 +791,7 @@ fn lifo_stealable() {
779791 // Before possibly panicking, make sure that we wake up the blocker task
780792 // so that it doesn't stop the runtime from shutting down.
781793 block_thread_tx. send ( ( ) ) . unwrap ( ) ;
794+ churn. abort ( ) ;
782795 result
783796 . expect ( "task in LIFO slot should complete within 30 seconds" )
784797 . expect ( "task in LIFO slot should not panic" ) ;
You can’t perform that action at this time.
0 commit comments