Zephyr API Documentation  3.7.0
A Scalable Open Source RTOS
3.7.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
MPSC Lockfree Queue API

Multiple Producer Single Consumer (MPSC) Lockfree Queue API. More...

Files

file  mpsc_lockfree.h
 A wait-free intrusive multi producer single consumer (MPSC) queue using a singly linked list.
 

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_nodempsc_pop (struct mpsc *q)
 Pop a node off of the list.
 

Detailed Description

Multiple Producer Single Consumer (MPSC) Lockfree Queue API.

Macro Definition Documentation

◆ MPSC_INIT

#define MPSC_INIT (   symbol)

#include <zephyr/sys/mpsc_lockfree.h>

Value:
{ \
.head = (struct mpsc_node *)&symbol.stub, \
.tail = (struct mpsc_node *)&symbol.stub, \
.stub = { \
.next = NULL, \
}, \
}
Queue member.
Definition: mpsc_lockfree.h:79

Static initializer for a mpsc queue.

Since the queue is

Parameters
symbolname of the queue

◆ mpsc_ptr_get

#define mpsc_ptr_get (   ptr)    atomic_ptr_get(&(ptr))

◆ mpsc_ptr_set

#define mpsc_ptr_set (   ptr,
  val 
)    atomic_ptr_set(&(ptr), val)

◆ mpsc_ptr_set_get

#define mpsc_ptr_set_get (   ptr,
  val 
)    atomic_ptr_set(&(ptr), val)

Typedef Documentation

◆ mpsc_ptr_t

Function Documentation

◆ mpsc_init()

static void mpsc_init ( struct mpsc q)
inlinestatic

#include <zephyr/sys/mpsc_lockfree.h>

Initialize queue.

Parameters
qQueue to initialize or reset

◆ mpsc_pop()

static struct mpsc_node * mpsc_pop ( struct mpsc q)
inlinestatic

#include <zephyr/sys/mpsc_lockfree.h>

Pop a node off of the list.

Return values
NULLWhen no node is available
nodeWhen node is available

◆ mpsc_push()

static ALWAYS_INLINE void mpsc_push ( struct mpsc q,
struct mpsc_node n 
)
static

#include <zephyr/sys/mpsc_lockfree.h>

Push a node.

Parameters
qQueue to push the node to
nNode to push into the queue