Skip to content

PROF_CTL requires async #30

@bobrik

Description

@bobrik

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions