Skip to main content

CondVar

Struct CondVar 

Source
pub struct CondVar { /* private fields */ }
Expand description

A condition variable, for more complex synchronization with a Mutex.

Implementations§

Source§

impl CondVar

Source

pub fn new(name: &str) -> Result<Self>

Creates a new condition variable.

Source

pub fn signal(&self) -> Result<()>

Signals the condition variable, waking up one waiting task.

Source

pub fn broadcast(&self) -> Result<()>

Broadcasts the condition variable, waking up all waiting tasks.

Source

pub fn wait(&self, _guard: MutexGuard<'_>) -> Result<()>

Waits for the condition variable to be signaled.

Note: OSAL condition variables have their own internal mutex (OS_CondVarLock/OS_CondVarUnlock). The _guard param here is consumed to enforce discipline, but the underlying OSAL wait operates on the condvar’s internal mutex, not the external one.

Source

pub fn timed_wait(&self, _guard: MutexGuard<'_>, abstime: OsTime) -> Result<()>

Atomically unlocks the mutex and waits for the condition variable, with a timeout.

Source

pub fn get_id_by_name(name: &str) -> Result<OsalId>

Finds an existing condition variable ID by its name.

Source

pub fn get_info(&self) -> Result<CondVarProp>

Retrieves information about this condition variable.

Trait Implementations§

Source§

impl Debug for CondVar

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for CondVar

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.