pub fn execute_on_main_thread_and_wait<F: Fn() + 'static>(f: F)
Execute passed function on the main thread and wait until the function is finished.
When not running in headless this will block the UI.