File tree 1 file changed +5
-1
lines changed
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ use crate::*;
27
27
/// When the main thread would exit, we will yield to any other thread that is ready to execute.
28
28
/// But we must only do that a finite number of times, or a background thread running `loop {}`
29
29
/// will hang the program.
30
- const MAIN_THREAD_YIELDS_AT_SHUTDOWN : u32 = 1_000 ;
30
+ const MAIN_THREAD_YIELDS_AT_SHUTDOWN : u32 = 256 ;
31
31
32
32
#[ derive( Copy , Clone , Debug , PartialEq ) ]
33
33
pub enum AlignmentCheck {
@@ -208,8 +208,12 @@ impl MainThreadState {
208
208
// Give background threads a chance to finish by yielding the main thread a
209
209
// couple of times -- but only if we would also preempt threads randomly.
210
210
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.
211
213
* self = Yield { remaining : MAIN_THREAD_YIELDS_AT_SHUTDOWN } ;
212
214
} else {
215
+ // The other threads did not get preempted, so no need to yield back to
216
+ // them.
213
217
* self = Done ;
214
218
}
215
219
}
You can’t perform that action at this time.
0 commit comments