pub struct AsyncSemaphore { /* private fields */ }Expand description
Async-capable wrappers for OSAL primitives.
An async-capable semaphore wrapping an Arc<Semaphore>.
Implementations§
Source§impl AsyncSemaphore
impl AsyncSemaphore
Sourcepub fn new(max_count: u32, initial_count: u32) -> Result<Self>
pub fn new(max_count: u32, initial_count: u32) -> Result<Self>
Creates an AsyncSemaphore with max_count and initial_count.
§Errors
Returns the underlying OSAL error if the semaphore cannot be created.
Sourcepub fn signal(&self) -> OsalRsBool
pub fn signal(&self) -> OsalRsBool
Signals (increments) the semaphore and wakes any async waiter.
Sourcepub fn wait_async(&self) -> WaitFuture<'_> ⓘ
pub fn wait_async(&self) -> WaitFuture<'_> ⓘ
Returns a Future that resolves when the semaphore count becomes > 0.
Auto Trait Implementations§
impl !RefUnwindSafe for AsyncSemaphore
impl !UnwindSafe for AsyncSemaphore
impl Freeze for AsyncSemaphore
impl Send for AsyncSemaphore
impl Sync for AsyncSemaphore
impl Unpin for AsyncSemaphore
impl UnsafeUnpin for AsyncSemaphore
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