CMSimpleQueue
A simple, lockless FIFO queue of elements.
Overview
Simple queues are Core Foundation-based objects that implement a simple, lockless FIFO queue of (void *) elements. The elements in the queue can be pointers or simple pointer-sized numeric values (NULL or 0 elements aren’t allowed). If the elements are pointers to allocated memory buffers, handle lifetime management externally.
A simple queue can safely handle one enqueueing thread and one dequeueing thread. Simple queues are lockless, so enqueues and dequeues can occur on the Core Audio ioProc thread, where the system forbids locking and blocking.
You can query the state of a simple queue to get the current number of elements and the maximum capacity of the queue. You can also determine the queue’s fullness, which the system provides as a percentage of its capacity.
You can reset a simple queue, which returns it to its newly created state, with no elements in the queue (but with the maximum capacity unchanged).