Struct futures_turnstyle::Turnstyle [−][src]
pub struct Turnstyle { /* fields omitted */ }
An ordered queue of waiting participants.
Every turn of the turnstyle, the next participant in queue is notified and removed from the
queue. If the queue is empty, turn
is a noop.
Turnstyles can be cloned and are safe to share across threads.
Methods
impl Turnstyle
[src]
impl Turnstyle
pub fn new() -> Turnstyle
[src]
pub fn new() -> Turnstyle
Creates a new, empty turnstyle.
pub fn join(&self) -> Waiter
[src]
pub fn join(&self) -> Waiter
Joins the waiting queue.
Returns a Waiter
to the caller, which will complete when the turnstyle turns and reaches
the caller's position in the queue.
pub fn turn(&self)
[src]
pub fn turn(&self)
Turns once, letting a single waiter through.
The Waiter
is notified by the future completing.