pub struct Unparker { /* private fields */ }
Expand description
Notifies a parker.
Implementations§
Source§impl 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 Freeze for Unparker
impl RefUnwindSafe for Unparker
impl Send for Unparker
impl Sync for Unparker
impl Unpin for Unparker
impl UnwindSafe for Unparker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)