ext/pf2/src/session.rs in pf2-0.5.1 vs ext/pf2/src/session.rs in pf2-0.5.2
- old
+ new
@@ -91,25 +91,30 @@
&configuration,
Arc::clone(&profile),
)),
};
+ let running = Arc::new(AtomicBool::new(false));
+
let new_thread_watcher = match threads {
configuration::Threads::All => {
let scheduler = Arc::clone(&scheduler);
+ let running = Arc::clone(&running);
Some(NewThreadWatcher::watch(move |thread: VALUE| {
- log::debug!("New Ruby thread detected: {:?}", thread);
- scheduler.on_new_thread(thread);
+ if running.load(Ordering::Relaxed) {
+ log::debug!("New Ruby thread detected: {:?}", thread);
+ scheduler.on_new_thread(thread);
+ }
}))
}
configuration::Threads::Targeted(_) => None,
};
Session {
configuration,
scheduler,
profile,
- running: Arc::new(AtomicBool::new(false)),
+ running,
new_thread_watcher,
}
}
fn parse_option_interval_ms(value: VALUE) -> Duration {