pub struct Semaphore(/* private fields */);Expand description
Represents a FreeRTOS counting semaphore.
Implementations§
Source§impl Semaphore
impl Semaphore
Sourcepub fn new(max_count: u32, init_count: u32) -> Self
pub fn new(max_count: u32, init_count: u32) -> Self
Creates a new semaphore. Panics on failure; see Semaphore::try_new.
Sourcepub fn try_new(max_count: u32, init_count: u32) -> Result<Self, Error>
pub fn try_new(max_count: u32, init_count: u32) -> Result<Self, Error>
Creates a new semaphore.
Sourcepub fn wait(&self, timeout: Duration) -> Result<(), Error>
pub fn wait(&self, timeout: Duration) -> Result<(), Error>
Blocks up to timeout until an instance of the semaphore can be taken
(i.e., its count decremented). If the semaphore cannot be taken (due
to timeout or other reason), an error is returned.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Semaphore
impl RefUnwindSafe for Semaphore
impl Unpin for Semaphore
impl UnwindSafe for Semaphore
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