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>
impl<T> SleepSemaphore<T>
pub const fn new(t: T) -> Self
unsafe fn wait(&self)
unsafe fn wakeup_one(&self)
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,
impl<T, E> Semaphore<T, E> for SleepSemaphore<T>where
T: ResourceMan<E>,
E: Copy + Clone,
Source§fn p(&self) -> Option<E>
fn p(&self) -> Option<E>
Probeer (try): the consumer end, tries to get resource, blocks on empty
Source§fn v(&self, e: E)
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>
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.