Struct r3::kernel::SemaphoreRef
source · pub struct SemaphoreRef<'a, System>(_, _)
where
System: KernelSemaphore;
Expand description
Represents a single borrowed semaphore in a system.
This type is ABI-compatible with System::
RawSemaphoreId
. It’s
logically equivalent to &'a Semaphore
but instead stores RawSemaphoreId
directly.
See Semaphore
for the owned counterpart and the description
of this kernel object.
See SemaphoreMethods
for the operations provided by this handle
type.
Implementations
sourceimpl<System> SemaphoreRef<'static, System>where
System: KernelSemaphore,
impl<System> SemaphoreRef<'static, System>where
System: KernelSemaphore,
sourcepub const fn define() -> SemaphoreDefiner<System>
pub const fn define() -> SemaphoreDefiner<System>
Construct a SemaphoreDefiner
to define a semaphore in a
configuration function.
Trait Implementations
sourceimpl<System> Clone for SemaphoreRef<'_, System>where
System: KernelSemaphore,
impl<System> Clone for SemaphoreRef<'_, System>where
System: KernelSemaphore,
sourcefn clone(&self) -> SemaphoreRef<'_, System>
fn clone(&self) -> SemaphoreRef<'_, System>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<System> Debug for SemaphoreRef<'_, System>where
System: KernelSemaphore,
impl<System> Debug for SemaphoreRef<'_, System>where
System: KernelSemaphore,
sourceimpl<System> Hash for SemaphoreRef<'_, System>where
System: KernelSemaphore,
impl<System> Hash for SemaphoreRef<'_, System>where
System: KernelSemaphore,
sourceimpl<System> PartialEq<Semaphore<System>> for SemaphoreRef<'_, System>where
System: NotSupportedYet,
impl<System> PartialEq<Semaphore<System>> for SemaphoreRef<'_, System>where
System: NotSupportedYet,
sourceimpl<System> PartialEq<SemaphoreRef<'_, System>> for Semaphore<System>where
System: NotSupportedYet,
impl<System> PartialEq<SemaphoreRef<'_, System>> for Semaphore<System>where
System: NotSupportedYet,
sourcefn eq(&self, other: &SemaphoreRef<'_, System>) -> bool
fn eq(&self, other: &SemaphoreRef<'_, System>) -> bool
sourceimpl<System> PartialEq<SemaphoreRef<'_, System>> for SemaphoreRef<'_, System>where
System: KernelSemaphore,
impl<System> PartialEq<SemaphoreRef<'_, System>> for SemaphoreRef<'_, System>where
System: KernelSemaphore,
sourcefn eq(&self, other: &SemaphoreRef<'_, System>) -> bool
fn eq(&self, other: &SemaphoreRef<'_, System>) -> bool
sourceimpl<System> SemaphoreHandle for SemaphoreRef<'_, System>where
System: KernelSemaphore,
impl<System> SemaphoreHandle for SemaphoreRef<'_, System>where
System: KernelSemaphore,
type System = System
type System = System
The system type this object pertains to.
sourceconst unsafe fn from_id(
id: <System as KernelSemaphore>::RawSemaphoreId
) -> SemaphoreRef<'_, System>
const unsafe fn from_id(
id: <System as KernelSemaphore>::RawSemaphoreId
) -> SemaphoreRef<'_, System>
sourceconst fn id(&self) -> <System as KernelSemaphore>::RawSemaphoreId
const fn id(&self) -> <System as KernelSemaphore>::RawSemaphoreId
Get the raw
RawSemaphoreId
value representing this object.sourceconst fn borrow(
&self
) -> SemaphoreRef<'_, <SemaphoreRef<'_, System> as SemaphoreHandle>::System>
const fn borrow(
&self
) -> SemaphoreRef<'_, <SemaphoreRef<'_, System> as SemaphoreHandle>::System>
impl<System> Copy for SemaphoreRef<'_, System>where
System: KernelSemaphore,
impl<System> Eq for SemaphoreRef<'_, System>where
System: KernelSemaphore,
Auto Trait Implementations
impl<'a, System> RefUnwindSafe for SemaphoreRef<'a, System>where
<System as KernelSemaphore>::RawSemaphoreId: RefUnwindSafe,
impl<'a, System> Send for SemaphoreRef<'a, System>
impl<'a, System> Sync for SemaphoreRef<'a, System>
impl<'a, System> Unpin for SemaphoreRef<'a, System>where
<System as KernelSemaphore>::RawSemaphoreId: Unpin,
impl<'a, System> UnwindSafe for SemaphoreRef<'a, System>where
<System as KernelSemaphore>::RawSemaphoreId: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> SemaphoreMethods for Twhere
T: SemaphoreHandle,
impl<T> SemaphoreMethods for Twhere
T: SemaphoreHandle,
sourcefn drain(&self) -> Result<(), DrainSemaphoreError>
fn drain(&self) -> Result<(), DrainSemaphoreError>
Remove all permits held by the semaphore.
sourcefn get(&self) -> Result<usize, GetSemaphoreError>
fn get(&self) -> Result<usize, GetSemaphoreError>
Get the number of permits currently held by the semaphore.
sourcefn signal(&self, count: usize) -> Result<(), SignalSemaphoreError>
fn signal(&self, count: usize) -> Result<(), SignalSemaphoreError>
Release
count
permits, returning them to the semaphore.sourcefn signal_one(&self) -> Result<(), SignalSemaphoreError>
fn signal_one(&self) -> Result<(), SignalSemaphoreError>
Release a permit, returning it to the semaphore.
sourcefn 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
sourcefn wait_one_timeout(
&self,
timeout: Duration
) -> Result<(), WaitSemaphoreTimeoutError>
fn wait_one_timeout(
&self,
timeout: Duration
) -> Result<(), WaitSemaphoreTimeoutError>
wait_one
with timeout.sourcefn 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. Read more