pub struct UnnamedSemaphoreBuilder { /* private fields */ }Expand description
Creates an UnnamedSemaphore which can be either used process locally or can be stored in a
shared memory segment and then used during inter-process communication.
§Example
use iceoryx2_bb_posix::semaphore::*;
let semaphore_handle = UnnamedSemaphoreHandle::new();
let semaphore = UnnamedSemaphoreBuilder::new().initial_value(5)
.is_interprocess_capable(false)
.clock_type(ClockType::Monotonic)
.create(&semaphore_handle)
.expect("failed to create unnamed semaphore");Implementations§
Source§impl UnnamedSemaphoreBuilder
impl UnnamedSemaphoreBuilder
pub fn new() -> UnnamedSemaphoreBuilder
Sourcepub fn initial_value(self, value: u32) -> UnnamedSemaphoreBuilder
pub fn initial_value(self, value: u32) -> UnnamedSemaphoreBuilder
Sets the initial value of the semaphore. Must be less than MAX_INITIAL_SEMAPHORE_VALUE.
Sourcepub fn is_interprocess_capable(self, value: bool) -> UnnamedSemaphoreBuilder
pub fn is_interprocess_capable(self, value: bool) -> UnnamedSemaphoreBuilder
Defines if the UnnamedSemaphore can be used in an inter-process communication context.
Sourcepub fn clock_type(self, value: ClockType) -> UnnamedSemaphoreBuilder
pub fn clock_type(self, value: ClockType) -> UnnamedSemaphoreBuilder
Sets the type of clock which will be used in SemaphoreInterface::timed_wait(). Be
aware a clock like ClockType::Realtime is depending on the systems local time. If this
time changes while waiting it can cause extrem long waits or no wait at all.
Sourcepub fn create(
self,
handle: &UnnamedSemaphoreHandle,
) -> Result<UnnamedSemaphore<'_>, UnnamedSemaphoreCreationError>
pub fn create( self, handle: &UnnamedSemaphoreHandle, ) -> Result<UnnamedSemaphore<'_>, UnnamedSemaphoreCreationError>
Creates an UnnamedSemaphore.
Trait Implementations§
Source§impl Debug for UnnamedSemaphoreBuilder
impl Debug for UnnamedSemaphoreBuilder
Source§impl Default for UnnamedSemaphoreBuilder
impl Default for UnnamedSemaphoreBuilder
Source§fn default() -> UnnamedSemaphoreBuilder
fn default() -> UnnamedSemaphoreBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for UnnamedSemaphoreBuilder
impl RefUnwindSafe for UnnamedSemaphoreBuilder
impl Send for UnnamedSemaphoreBuilder
impl Sync for UnnamedSemaphoreBuilder
impl Unpin for UnnamedSemaphoreBuilder
impl UnwindSafe for UnnamedSemaphoreBuilder
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