Struct avr_oxide::concurrency::sync::EventWait

source ·
pub struct EventWait { /* private fields */ }
Expand description

A simple synchronisation primitive that allows one or more threads to wait until an event is signalled by another the thread.

When the event occurs, the signalling thread may release one or all of the waiting threads.

Implementations§

source§

impl EventWait

source

pub fn new() -> Self

Create a new EventWait instance, with no blocked threads.

source

pub fn wait(&mut self)

Block the calling thread waiting for an event to be signalled by another thread calling one of the release() methods.

source

pub fn add_to_waitlist(&mut self, isotoken: Isolated)

Add the calling thread to the wait list WITHOUT immediately blocking. Note that even though it will not immediately block, there is a possibility the caller will be pre-empted and blocked practically immediately anyway, so it is the caller’s responsbility to ensure they keep interrupts disabled for as long as they need to do anything before they yield.

source

pub fn release_one(&mut self)

Release one waiting thread (if any)

source

pub fn release_all(&mut self)

Release all waiting threads (if any)

source

pub fn release(&mut self, count: usize)

Release up to a maximum of count waiting threads (if any)

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.