Crate wakerizer

Source
Expand description

wakerizer is intended to be used to keep track of multiple Futures waiting for a single (shared) resource.

It can assist in developing behaviors vaguely similar to Condvar’s notify_all().

§Usage

A resource that may be waited on creates and stores a Wakers object.

Each time a Future is created that will be waiting for the resource, its Wakers spawns a Waiter, which is stored with the Future.

If the Future’s poll() function returns Poll::Pending, it calls its Waiter::prime() to indicate that it is a Future that is actively waiting.

Whenever the resource is ready, it can signal waiting futures using Wakers::wake_all().

Structs§

Waiter
Representation of a waker in waiting state.
Wakers
A set of wakers that can be used to wake up pending futures.