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. - Mutex
Builder - Creates a
Mutex. - Mutex
Guard - A guard which allows the modification of a value guarded by a
Mutex. It is returned inMutex::lock(),Mutex::try_lock()andMutex::timed_lock(). - Mutex
Handle - Named
Semaphore - 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. - Named
Semaphore Builder - Builder for the
NamedSemaphore. - Named
Semaphore Creation Builder - 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.
- Trigger
Queue - Unnamed
Semaphore - An unnamed semaphore which can be used process locally or for inter-process triggers.
- Unnamed
Semaphore Builder - Creates an
UnnamedSemaphorewhich can be either used process locally or can be stored in a shared memory segment and then used during inter-process communication. - Unnamed
Semaphore Handle
Enums§
- Clock
Type - Represents different low level clocks.
- Creation
Mode - Describes how new resources like
crate::file::File,crate::shared_memory::SharedMemoryor others should be created. - Mutex
Creation Error - Mutex
Error - 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. - Mutex
Lock Error - Mutex
Thread Termination Behavior - Defines the behavior when a mutex owning thread is terminated
- Mutex
Timed Lock Error - Mutex
Type - The type of a mutex defines its behavior.
- Mutex
Unlock Error - Named
Semaphore Creation Error - Semaphore
Error - 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. - Semaphore
Post Error - Semaphore
Timed Wait Error - Semaphore
Wait Error - Unnamed
Semaphore Creation Error - Unnamed
Semaphore Open IpcHandle Error
Traits§
- Handle
- Represents a handle that is in general inter-process capable.
- IpcCapable
- Represents struct that can be configured for inter-process use.
- Semaphore
Interface - Defines the interface of a
NamedSemaphoreand anUnnamedSemaphore.