|
3 | 3 | use std::cell::RefCell;
|
4 | 4 | use std::collections::hash_map::Entry;
|
5 | 5 | use std::num::TryFromIntError;
|
6 |
| -use std::sync::atomic::{AtomicBool, Ordering::Relaxed}; |
| 6 | +use std::sync::atomic::Ordering::Relaxed; |
7 | 7 | use std::task::Poll;
|
8 | 8 | use std::time::{Duration, SystemTime};
|
9 | 9 |
|
10 | 10 | use either::Either;
|
11 | 11 |
|
| 12 | +use rustc_const_eval::CTRL_C_RECEIVED; |
12 | 13 | use rustc_data_structures::fx::FxHashMap;
|
13 | 14 | use rustc_hir::def_id::DefId;
|
14 | 15 | use rustc_index::{Idx, IndexVec};
|
@@ -1045,21 +1046,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
1045 | 1046 | /// Run the core interpreter loop. Returns only when an interrupt occurs (an error or program
|
1046 | 1047 | /// termination).
|
1047 | 1048 | fn run_threads(&mut self) -> InterpResult<'tcx, !> {
|
1048 |
| - static SIGNALED: AtomicBool = AtomicBool::new(false); |
1049 |
| - ctrlc::set_handler(move || { |
1050 |
| - // Indicate that we have ben signaled to stop. If we were already signaled, exit |
1051 |
| - // immediately. In our interpreter loop we try to consult this value often, but if for |
1052 |
| - // whatever reason we don't get to that check or the cleanup we do upon finding that |
1053 |
| - // this bool has become true takes a long time, the exit here will promptly exit the |
1054 |
| - // process on the second Ctrl-C. |
1055 |
| - if SIGNALED.swap(true, Relaxed) { |
1056 |
| - std::process::exit(1); |
1057 |
| - } |
1058 |
| - }) |
1059 |
| - .unwrap(); |
1060 | 1049 | let this = self.eval_context_mut();
|
1061 | 1050 | loop {
|
1062 |
| - if SIGNALED.load(Relaxed) { |
| 1051 | + if CTRL_C_RECEIVED.load(Relaxed) { |
1063 | 1052 | this.machine.handle_abnormal_termination();
|
1064 | 1053 | std::process::exit(1);
|
1065 | 1054 | }
|
|
0 commit comments