Expand description
wakerizer is intended to be used to keep track of multiple Future
s
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()
.