#[repr(transparent)]pub struct Semaphore<System: NotSupportedYet>(_);
Expand description
Represents a single semaphore in a system.
This type is ABI-compatible with System::
RawSemaphoreId
.
See SemaphoreRef
for the borrowed counterpart.
See SemaphoreMethods
for the operations provided by this handle
type.
A semaphore maintains a set of permits that can be acquired (possibly
blocking) or released by application code. The number of permits held by a
semaphore is called the semaphore’s value and represented by
SemaphoreValue
.
Relation to Other Specifications: Present in almost every real-time operating system.
Trait Implementations§
source§impl<System: NotSupportedYet> PartialEq<Semaphore<System>> for Semaphore<System>
impl<System: NotSupportedYet> PartialEq<Semaphore<System>> for Semaphore<System>
source§impl<System: NotSupportedYet> PartialEq<Semaphore<System>> for SemaphoreRef<'_, System>
impl<System: NotSupportedYet> PartialEq<Semaphore<System>> for SemaphoreRef<'_, System>
source§impl<System: NotSupportedYet> PartialEq<SemaphoreRef<'_, System>> for Semaphore<System>
impl<System: NotSupportedYet> PartialEq<SemaphoreRef<'_, System>> for Semaphore<System>
source§fn eq(&self, other: &SemaphoreRef<'_, System>) -> bool
fn eq(&self, other: &SemaphoreRef<'_, System>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<System: NotSupportedYet> SemaphoreHandle for Semaphore<System>
impl<System: NotSupportedYet> SemaphoreHandle for Semaphore<System>
source§const unsafe fn from_id(id: <System as KernelSemaphore>::RawSemaphoreId) -> Self
const unsafe fn from_id(id: <System as KernelSemaphore>::RawSemaphoreId) -> Self
source§const fn id(&self) -> System::RawSemaphoreId
const fn id(&self) -> System::RawSemaphoreId
Get the raw
RawSemaphoreId
value representing this object.source§const fn borrow(&self) -> SemaphoreRef<'_, Self::System>
const fn borrow(&self) -> SemaphoreRef<'_, Self::System>
impl<System: NotSupportedYet> Eq for Semaphore<System>
Auto Trait Implementations§
impl<System> RefUnwindSafe for Semaphore<System>where <System as KernelSemaphore>::RawSemaphoreId: RefUnwindSafe,
impl<System> Send for Semaphore<System>
impl<System> Sync for Semaphore<System>
impl<System> Unpin for Semaphore<System>where <System as KernelSemaphore>::RawSemaphoreId: Unpin,
impl<System> UnwindSafe for Semaphore<System>where <System as KernelSemaphore>::RawSemaphoreId: UnwindSafe,
Blanket Implementations§
source§impl<T> SemaphoreMethods for Twhere
T: SemaphoreHandle,
impl<T> SemaphoreMethods for Twhere T: SemaphoreHandle,
source§fn get(&self) -> Result<SemaphoreValue, GetSemaphoreError>
fn get(&self) -> Result<SemaphoreValue, GetSemaphoreError>
Get the number of permits currently held by the semaphore.
source§fn signal(&self, count: SemaphoreValue) -> Result<(), SignalSemaphoreError>
fn signal(&self, count: SemaphoreValue) -> Result<(), SignalSemaphoreError>
Release
count
permits, returning them to the semaphore.source§fn signal_one(&self) -> Result<(), SignalSemaphoreError>
fn signal_one(&self) -> Result<(), SignalSemaphoreError>
Release a permit, returning it to the semaphore.
source§fn wait_one(&self) -> Result<(), WaitSemaphoreError>
fn wait_one(&self) -> Result<(), WaitSemaphoreError>
Acquire a permit, potentially blocking the calling thread until one is
available. Read more
source§fn wait_one_timeout(
&self,
timeout: Duration
) -> Result<(), WaitSemaphoreTimeoutError>
fn wait_one_timeout( &self, timeout: Duration ) -> Result<(), WaitSemaphoreTimeoutError>
wait_one
with timeout.source§fn poll_one(&self) -> Result<(), PollSemaphoreError>
fn poll_one(&self) -> Result<(), PollSemaphoreError>
Non-blocking version of
wait_one
. Returns
immediately with PollSemaphoreError::Timeout
if the unblocking
condition is not satisfied.