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