[−][src]Struct sync_stack::SyncStack
A stack of blocked threads.
Methods
impl SyncStack
[src]
pub const INIT: Self
[src]
An empty SyncStack
.
pub const fn new() -> Self
[src]
Returns Self::INIT
.
pub fn park<P>(&self) -> bool where
P: Park,
[src]
P: Park,
Attempts to block the current thread on the top of the SyncStack
.
Returns true
if this thread was blocked and then unblocked.
Note that the Park
implementation used does not have to be the same for every
call to park
; as such different thread implementations can all wait on the same
SyncStack
.
use sync_stack::*; static STACK: SyncStack = SyncStack::INIT; std::thread::spawn(move || { //This threads execution stops. STACK.park::<Thread>(); println!("Ran Second"); }); println!("Ran First"); //The other thread resumes execution. STACK.pop();
pub fn pop(&self) -> bool
[src]
Unblocks a thread from the SyncStack
.
Returns false
if the stack was empty.
Auto Trait Implementations
Blanket Implementations
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,