Zephyr Project API 3.7.0-rc1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
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)   ptr
 
#define mpsc_ptr_set(ptr, val)   ptr = val
 
#define mpsc_ptr_set_get(ptr, val)
 
#define MPSC_INIT(symbol)
 Static initializer for a mpsc queue.
 

Typedefs

typedef struct mpsc_nodempsc_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 <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)    ptr

◆ mpsc_ptr_set

#define mpsc_ptr_set (   ptr,
  val 
)    ptr = val

◆ mpsc_ptr_set_get

#define mpsc_ptr_set_get (   ptr,
  val 
)

#include <include/zephyr/sys/mpsc_lockfree.h>

Value:
({ \
mpsc_ptr_t tmp = ptr; \
ptr = val; \
tmp; \
})
void * ptr
Definition printk.c:177

Typedef Documentation

◆ mpsc_ptr_t

Function Documentation

◆ mpsc_init()

static void mpsc_init ( struct mpsc q)
inlinestatic

#include <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 <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 <include/zephyr/sys/mpsc_lockfree.h>

Push a node.

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