Currently we have:
|
/// Per-process singleton for controlling jemalloc profiling. |
|
pub static PROF_CTL: Lazy<Option<Arc<Mutex<JemallocProfCtl>>>> = |
|
Lazy::new(|| JemallocProfCtl::get().map(|ctl| Arc::new(Mutex::new(ctl)))); |
The Mutex here is tokio::sync::Mutex, which means that it can only be taken in async functions, which makes it really awkward to use in synchronous code. At the same time, the mutex doesn't guard anything that would justify it.
Tokio mutex is mostly there to allow holding it across .await:
Currently we have:
rust-jemalloc-pprof/src/lib.rs
Lines 71 to 73 in df74643
The
Mutexhere istokio::sync::Mutex, which means that it can only be taken inasyncfunctions, which makes it really awkward to use in synchronous code. At the same time, the mutex doesn't guard anything that would justify it.Tokio mutex is mostly there to allow holding it across
.await: