[−][src]Struct futures::task::AtomicWaker
A synchronization primitive for task wakeup.
Sometimes the task interested in a given event will change over time.
An AtomicWaker
can coordinate concurrent notifications with the consumer
potentially "updating" the underlying task to wake up. This is useful in
scenarios where a computation completes in another thread and wants to
notify the consumer, but the consumer is in the process of being migrated to
a new logical task.
Consumers should call register
before checking the result of a computation
and producers should call wake
after producing the computation (this
differs from the usual thread::park
pattern). It is also permitted for
wake
to be called before register
. This results in a no-op.
A single AtomicWaker
may be reused for any number of calls to register
or
wake
.
AtomicWaker
does not provide any memory ordering guarantees, as such the
user should use caution and use other synchronization primitives to guard
the result of the underlying computation.
Methods
impl AtomicWaker
[src][−]
pub fn new() -> AtomicWaker
[src][+]
pub fn register(&self, waker: &Waker)
[src][+]
pub fn wake(&self)
[src][+]
pub fn take(&self) -> Option<Waker>
[src][+]
Trait Implementations
impl Sync for AtomicWaker
[src]
impl Default for AtomicWaker
[src][+]
impl Send for AtomicWaker
[src]
impl Debug for AtomicWaker
[src][+]
Blanket Implementations
impl<T> From for T
[src][+]
impl<T, U> Into for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T> Borrow for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,