pub struct Unparker { /* private fields */ }
Expand description
Notifies a parker.
Implementations
sourceimpl Unparker
impl Unparker
sourcepub fn unpark(&self) -> bool
pub fn unpark(&self) -> bool
Notifies the associated parker.
Returns true
if this call is the first to notify the parker, or false
if the parker
was already notified.
Examples
use std::thread;
use std::time::Duration;
use parking::Parker;
let p = Parker::new();
let u = p.unparker();
thread::spawn(move || {
thread::sleep(Duration::from_millis(500));
u.unpark();
});
// Wakes up when `u.unpark()` notifies and then goes back into unnotified state.
p.park();
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Unparker
impl Send for Unparker
impl Sync for Unparker
impl Unpin for Unparker
impl !UnwindSafe for Unparker
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more