[][src]Struct sync_stack::SyncStack

pub struct SyncStack(_);

A stack of blocked threads.


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

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.
  println!("Ran Second");
println!("Ran First");
//The other thread resumes execution.

pub fn pop(&self) -> bool[src]

Unblocks a thread from the SyncStack.

Returns false if the stack was empty.

Auto Trait Implementations

impl Send for SyncStack

impl Sync for SyncStack

Blanket Implementations

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> From<T> for T[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> Any for T where
    T: 'static + ?Sized