Queues

A Queue in Zephyr is a kernel object that implements a traditional queue, allowing threads and ISRs to add and remove data items of any size. The queue is similar to a FIFO and serves as the underlying implementation for both k_fifo and k_lifo. For more information on usage see k_fifo.

Cancelling a Wait

A thread that is blocked waiting to retrieve an item from a queue can be released without an item by calling k_queue_cancel_wait() from another thread or an ISR. The first thread pending on the queue returns from its k_queue_get() call with a NULL value, exactly as if its timeout had expired. If the queue is instead being waited on through k_poll(), that call returns -EINTR with the poll event in the cancelled state.

This mechanism is also available to the queue-based primitives through k_fifo_cancel_wait and k_lifo_cancel_wait.

Configuration Options

Related configuration options:

  • None

API Reference

Queue APIs