From e9079ab31dacfc5ba359184ce7d6a25b2e235468 Mon Sep 17 00:00:00 2001 From: Matt Paras Date: Sun, 27 Oct 2024 13:07:01 -0700 Subject: [PATCH] fix main thread getting stuck at interrupts --- crates/steel-core/src/steel_vm/vm.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/steel-core/src/steel_vm/vm.rs b/crates/steel-core/src/steel_vm/vm.rs index 79a9451c2..90e9c4d1d 100644 --- a/crates/steel-core/src/steel_vm/vm.rs +++ b/crates/steel-core/src/steel_vm/vm.rs @@ -572,13 +572,19 @@ impl SteelThread { let res = finish(self); if cfg!(feature = "sync") { - // Just block here until we're out + // Just block here until we're out - this only applies if we're not the main thread and + // not in garbage collection while self .synchronizer .state .paused .load(std::sync::atomic::Ordering::Relaxed) { + match self.synchronizer.state.state.load() { + ThreadState::Interrupted => break, + _ => {} + } + std::thread::park(); }