pub struct BinSem { /* private fields */ }Expand description
A binary semaphore, often used for signaling between tasks.
Implementations§
Source§impl BinSem
impl BinSem
Sourcepub fn new(name: &str, initial_value: SemState) -> Result<Self>
pub fn new(name: &str, initial_value: SemState) -> Result<Self>
Creates a new binary semaphore.
§Arguments
name: A unique string to identify the semaphore.initial_value: The initial state of the semaphore.
Sourcepub fn flush(&self) -> Result<()>
pub fn flush(&self) -> Result<()>
Unblocks all tasks pending on the specified semaphore.
This function does not change the state of the semaphore.
Sourcepub fn timed_wait(&self, timeout_ms: u32) -> Result<()>
pub fn timed_wait(&self, timeout_ms: u32) -> Result<()>
Blocks until the semaphore can be taken, with a timeout.
§Arguments
timeout_ms: Timeout in milliseconds.
Sourcepub fn get_id_by_name(name: &str) -> Result<OsalId>
pub fn get_id_by_name(name: &str) -> Result<OsalId>
Finds an existing binary semaphore ID by its name.
Sourcepub fn get_info(&self) -> Result<BinSemProp>
pub fn get_info(&self) -> Result<BinSemProp>
Retrieves information about this binary semaphore.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BinSem
impl RefUnwindSafe for BinSem
impl Send for BinSem
impl Sync for BinSem
impl Unpin for BinSem
impl UnsafeUnpin for BinSem
impl UnwindSafe for BinSem
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