fn dispatch_to_main_if_needed()

in native/desktop-macos/src/macos/notifications.rs [179:193]


fn dispatch_to_main_if_needed<F>(f: F)
where
    F: FnOnce() + Send + 'static,
{
    if MainThreadMarker::new().is_some() {
        f();
    } else {
        DispatchQueue::main().exec_async(move || {
            catch_panic(move || {
                f();
                Ok(())
            });
        });
    }
}