This is the async
-ready almost-equivalent of CountdownEvent, similar to Stephen Toub's AsyncCountdownEvent. It's only an almost equivalent because the AsyncCountdownEvent
does not allow itself to be reset.
An AsyncCountdownEvent
starts out unset and becomes set only once, when its count reaches zero. Its current count can be manipulated by any other tasks up until the time it reaches zero. When the count reaches zero, all waiting tasks are released.
The task returned from WaitAsync
will enter the Completed
state when the AsyncCountdownEvent
has counted down to zero and enters the set state.