pub struct Sem { /* private fields */ }
Expand description
POSIX implementation of Semaphore
Note: wait_timeout
returns false on interrupt by signal
Trait Implementations§
Source§impl Semaphore for Sem
impl Semaphore for Sem
Source§fn new(init: u32) -> Option<Self>
fn new(init: u32) -> Option<Self>
Creates new instance, returning None on inability to do so. Read more
Source§fn try_wait(&self) -> bool
fn try_wait(&self) -> bool
Attempts to decrement self, returning whether self was signaled or not. Read more
Source§fn wait_timeout(&self, timeout: Duration) -> bool
fn wait_timeout(&self, timeout: Duration) -> bool
Attempts to decrement self within provided time, returning whether self was signaled or not. Read more
Source§fn post(&self) -> bool
fn post(&self) -> bool
Increments self, returning whether another thread has been woken as result.
Source§fn lock(&self) -> SemaphoreGuard<'_, Self>
fn lock(&self) -> SemaphoreGuard<'_, Self>
Gets semaphore’s guard, which signal on drop. Read more
impl Send for Sem
impl Sync for Sem
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more