rustubs::proc::sync::semaphore

Struct SleepSemaphore

Source
pub struct SleepSemaphore<T> {
    pub resource_pool: SyncUnsafeCell<T>,
    pub sema: AtomicU64,
    pub wait_room: SyncUnsafeCell<VecDeque<TaskId>>,
}

Fields§

§resource_pool: SyncUnsafeCell<T>§sema: AtomicU64§wait_room: SyncUnsafeCell<VecDeque<TaskId>>

Implementations§

Source§

impl<T> SleepSemaphore<T>

Source

pub const fn new(t: T) -> Self

Source

unsafe fn wait(&self)

Source

unsafe fn wakeup_one(&self)

Source

pub unsafe fn get_pool_mut(&self) -> &mut T

Trait Implementations§

Source§

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

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§

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)

Source§

fn is_empty(&self) -> bool

must not block
Source§

fn is_full(&self) -> bool

must not block

Auto Trait Implementations§

§

impl<T> !Freeze for SleepSemaphore<T>

§

impl<T> !RefUnwindSafe for SleepSemaphore<T>

§

impl<T> Send for SleepSemaphore<T>
where T: Send,

§

impl<T> Sync for SleepSemaphore<T>
where T: Sync,

§

impl<T> Unpin for SleepSemaphore<T>
where T: Unpin,

§

impl<T> UnwindSafe for SleepSemaphore<T>
where T: UnwindSafe,

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T, U> TryFrom<U> for T
where 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>

Performs the conversion.
§

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

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

Performs the conversion.