// Copyright 2024 The ChromiumOS Authors1// Use of this source code is governed by a BSD-style license that can be2// found in the LICENSE file.34/// An async version of `base::Event`.5pub struct EventTokio(base::Event);67impl EventTokio {8/// Must be a manual-reset event (i.e. created by `base::Event::new()`).9///10/// TODO: Add support for auto-reset events.11pub fn new(event: base::Event) -> anyhow::Result<Self> {12Ok(Self(event))13}1415/// Blocks until the event is signaled and clears the signal.16///17/// It is undefined behavior to wait on an event from multiple threads or processes18/// simultaneously.19pub async fn wait(&self) -> std::io::Result<()> {20base::sys::windows::async_wait_for_single_object(&self.0).await?;21self.0.reset()?;22Ok(())23}24}252627