[−][src]Crate wait_for_me
This library provide an implementation of an async CountDownLatch
,
which keeps a counter syncronized via Mutex
in it's internal state and allows tasks to wait until
the counter reaches zero.
Example
use wait_for_me::CountDownLatch; use smol::{self,Task}; fn main() -> Result<(), Box<std::error::Error>> { smol::run(async { let latch = CountDownLatch::new(1); let latch1 = latch.clone(); Task::spawn(async move { latch1.count_down().await; }).detach(); latch.wait().await; Ok(()) }) }
Structs
CountDownLatch | A syncronization primitive that allow one or more tasks to wait untile the given counter reaches zero. This is an async port of CountDownLatch in Java. |