This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ use crate::*;
2727/// When the main thread would exit, we will yield to any other thread that is ready to execute.
2828/// But we must only do that a finite number of times, or a background thread running `loop {}`
2929/// will hang the program.
30- const MAIN_THREAD_YIELDS_AT_SHUTDOWN : u32 = 1_000 ;
30+ const MAIN_THREAD_YIELDS_AT_SHUTDOWN : u32 = 256 ;
3131
3232#[ derive( Copy , Clone , Debug , PartialEq ) ]
3333pub enum AlignmentCheck {
@@ -208,8 +208,12 @@ impl MainThreadState {
208208 // Give background threads a chance to finish by yielding the main thread a
209209 // couple of times -- but only if we would also preempt threads randomly.
210210 if this. machine . preemption_rate > 0.0 {
211+ // There is a non-zero chance they will yield back to us often enough to
212+ // make Miri terminate eventually.
211213 * self = Yield { remaining : MAIN_THREAD_YIELDS_AT_SHUTDOWN } ;
212214 } else {
215+ // The other threads did not get preempted, so no need to yield back to
216+ // them.
213217 * self = Done ;
214218 }
215219 }
You can’t perform that action at this time.
0 commit comments