Zephyr API Documentation
3.6.99
A Scalable Open Source RTOS
|
A wait-free intrusive multi producer single consumer (MPSC) queue using a singly linked list. More...
Go to the source code of this file.
Data Structures | |
struct | rtio_mpsc_node |
Queue member. More... | |
struct | rtio_mpsc |
MPSC Queue. More... | |
Macros | |
#define | mpsc_ptr_get(ptr) atomic_ptr_get(&(ptr)) |
#define | mpsc_ptr_set(ptr, val) atomic_ptr_set(&(ptr), val) |
#define | mpsc_ptr_set_get(ptr, val) atomic_ptr_set(&(ptr), val) |
#define | RTIO_MPSC_INIT(symbol) |
Static initializer for a mpsc queue. | |
Typedefs | |
typedef atomic_ptr_t | mpsc_ptr_t |
Functions | |
static void | rtio_mpsc_init (struct rtio_mpsc *q) |
Initialize queue. | |
static ALWAYS_INLINE void | rtio_mpsc_push (struct rtio_mpsc *q, struct rtio_mpsc_node *n) |
Push a node. | |
static struct rtio_mpsc_node * | rtio_mpsc_pop (struct rtio_mpsc *q) |
Pop a node off of the list. | |
A wait-free intrusive multi producer single consumer (MPSC) queue using a singly linked list.
Ordering is First-In-First-Out.
Based on the well known and widely used wait-free MPSC queue described by Dmitry Vyukov with some slight changes to account for needs of an RTOS on a variety of archs. Both consumer and producer are wait free. No CAS loop or lock is needed.
An MPSC queue is safe to produce or consume in an ISR with O(1) push/pop.