Zephyr Project API 3.7.0
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 | mpsc_node |
Queue member. More... | |
struct | 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 | MPSC_INIT(symbol) |
Static initializer for a mpsc queue. | |
Typedefs | |
typedef atomic_ptr_t | mpsc_ptr_t |
Functions | |
static void | mpsc_init (struct mpsc *q) |
Initialize queue. | |
static ALWAYS_INLINE void | mpsc_push (struct mpsc *q, struct mpsc_node *n) |
Push a node. | |
static struct mpsc_node * | mpsc_pop (struct 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.