Module trigger_queue

Module trigger_queue 

Source
Expand description

A threadsafe queue which triggers a consumer when data arrived or triggers the producer when the queue is no longer full.

§Example


use std::thread;
use iceoryx2_bb_threadsafe::trigger_queue::*;

const CAPACITY: usize = 16;

let mtx_handle = MutexHandle::new();
let free_handle = UnnamedSemaphoreHandle::new();
let used_handle = UnnamedSemaphoreHandle::new();

let queue = TriggerQueue::<u64, CAPACITY>::new(&mtx_handle, &free_handle, &used_handle);

thread::scope(|s| {
    let consumer = s.spawn(|| {
        for i in 0..10 {
            println!("got: {}", queue.blocking_pop());
        }
    });

    let producer = s.spawn(|| {
        for i in 0..10 {
            queue.blocking_push(i);
            println!("pushed data {}", i);
        }
    });
})

Structs§

Mutex
Represents a POSIX mutex which can be created by the MutexBuilder.
MutexBuilder
Creates a Mutex.
MutexGuard
A guard which allows the modification of a value guarded by a Mutex. It is returned in Mutex::lock(), Mutex::try_lock() and Mutex::timed_lock().
MutexHandle
NamedSemaphore
Represents a POSIX named semaphore - a semaphore with a corresponding file handle which can be opened by other processes. The filename corresponds to the semaphore name. A named semaphore is created by the NamedSemaphoreBuilder.
NamedSemaphoreBuilder
Builder for the NamedSemaphore.
NamedSemaphoreCreationBuilder
Provides additional settings which are only available for newly created semaphores. Is returned by NamedSemaphoreBuilder::creation_mode().
Permission
Defines the permission of a file or directory in a POSIX system.
TriggerQueue
UnnamedSemaphore
An unnamed semaphore which can be used process locally or for inter-process triggers.
UnnamedSemaphoreBuilder
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.
UnnamedSemaphoreHandle

Enums§

ClockType
Represents different low level clocks.
CreationMode
Describes how new resources like crate::file::File, crate::shared_memory::SharedMemory or others should be created.
MutexCreationError
MutexError
The MutexError enum is a generalization when one doesn’t require the fine-grained error handling enums. One can forward MutexError as more generic return value when a method returns a Mutex***Error. On a higher level it is again convertable to crate::Error.
MutexLockError
MutexThreadTerminationBehavior
Defines the behavior when a mutex owning thread is terminated
MutexTimedLockError
MutexType
The type of a mutex defines its behavior.
MutexUnlockError
NamedSemaphoreCreationError
SemaphoreError
The SemaphoreError enum is a generalization when one doesn’t require the fine-grained error handling enums. One can forward SemaphoreError as more generic return value when a method returns a Semaphore***Error. On a higher level it is again convertable to crate::Error.
SemaphorePostError
SemaphoreTimedWaitError
SemaphoreWaitError
UnnamedSemaphoreCreationError
UnnamedSemaphoreOpenIpcHandleError

Traits§

Handle
Represents a handle that is in general inter-process capable.
IpcCapable
Represents struct that can be configured for inter-process use.
SemaphoreInterface
Defines the interface of a NamedSemaphore and an UnnamedSemaphore.