Function with_current_name

pub(crate) fn with_current_name<F, R>(f: F) -> R
where
    F: FnOnce(Option<&str>) -> R,

Run a function with the current thread's name.

Modulo thread local accesses, this function is safe to call from signal handlers and in similar circumstances where allocations are not possible.