[][src]Trait sync_stack::Park

pub unsafe trait Park: 'static + Send + Sync {
    fn new() -> Self;
fn park();
fn unpark(&self); }

An handle used to unpark a thread.

Note that thread need not mean std::thread::Thread but could be any number of user/kernal thread implementations.

An implementation for std::thread::Thread is available behind the std feature.

Required methods

fn new() -> Self

Returns a handle to unpark the current thread.

fn park()

Parks the current thread when called.

Safety

To avoid deadlocks occouring it is important that in the following execution order this function exists immediatly.

  • thread1 start
  • thread2 start
  • thread1 pass unpark handle to thread2
  • thread2 unparks thread1
  • thread1 attempts to park

fn unpark(&self)

Unparks the thread handled by this instance when called.

See park documentation for details.

Loading content...

Implementors

Loading content...