luaur_repl_cli/functions/profiler_stop.rs
1//! Faithful port of `void profilerStop()` (CLI/src/Profiler.cpp:109).
2
3use core::sync::atomic::Ordering;
4
5use crate::functions::profiler_trigger::G_PROFILER;
6
7pub fn profiler_stop() {
8 unsafe {
9 let profiler = core::ptr::addr_of_mut!(G_PROFILER).as_mut().unwrap();
10 profiler.exit.store(true, Ordering::Relaxed);
11 if let Some(handle) = profiler.thread.take() {
12 let _ = handle.join();
13 }
14 }
15}