rustubs::proc::sync::semaphore

Trait Semaphore

Source
pub trait Semaphore<T, E>
where T: ResourceMan<E>, E: Copy + Clone,
{ // Required methods fn p(&self) -> Option<E>; fn v(&self, e: E); fn is_empty(&self) -> bool; fn is_full(&self) -> bool; // Provided methods unsafe fn p_unguarded(&self) -> Option<E> { ... } unsafe fn v_unguarded(&self, e: E) { ... } }

Required Methods§

Source

fn p(&self) -> Option<E>

Probeer (try): the consumer end, tries to get resource, blocks on empty

Source

fn v(&self, e: E)

Verhoog (increment): the producer end, increments the resource and must not block

Source

fn is_empty(&self) -> bool

must not block

Source

fn is_full(&self) -> bool

must not block

Provided Methods§

Source

unsafe fn p_unguarded(&self) -> Option<E>

if the semaphore is also to be accessed in the epilogue level, the L2 lock is already acquired.

Source

unsafe fn v_unguarded(&self, e: E)

Implementors§

Source§

impl<T, E> Semaphore<T, E> for SleepSemaphore<T>
where T: ResourceMan<E>, E: Copy + Clone,