pub async fn wait_for_flag(flag: &AtomicBool, max_wait: Duration) -> bool
Wait for a boolean flag to become true