pub fn execute_with_max_available_threads<T: Sync + Send>(
    f: impl FnOnce() -> T + Send
) -> T