pub struct Semaphore { /* private fields */ }
Expand description

Atomic counting semaphore

similar to Struct tokio::sync::Semaphore and super::Mutex.

A semaphore can be used to

  • synchronize on one or more event (e.g. interrupt)
  • synchronize multiple tasks

Implementations

Allocate an event ot the semaphore.

Note: The kernel must be initialized before calling this method.

Try to acquire a semaphore permit (non-blocking). Returns a SemaphorePermit or an error if no permit is available or semaphore is poisoned.

Try to acquire a semaphore permit (blocking). Returns a SemaphorePermit or an error if the request timed out or the semaphore was poisoned.

Note: The timeout function is not implemented yet.

Number of permits that can be issued from this semaphore

Trait Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.