Lock-free MPSC singly-linked list
include/structures/mpsc_list.h View source View on GitHubStructs
Section titled “Structs”mpsc_slist_node
Section titled “mpsc_slist_node”struct mpsc_slist_node {
struct mpsc_slist_node *next;
}; mpsc_slist
Section titled “mpsc_slist”struct mpsc_slist {
_Atomic (struct mpsc_slist_node *) head;
}; Functions
Section titled “Functions”mpsc_slist_init
Section titled “mpsc_slist_init”void mpsc_slist_init(struct mpsc_slist *q); mpsc_slist_empty
Section titled “mpsc_slist_empty”int mpsc_slist_empty(const struct mpsc_slist *q); mpsc_slist_push
Section titled “mpsc_slist_push”bool mpsc_slist_push(struct mpsc_slist *q, struct mpsc_slist_node *n); mpsc_slist_drain
Section titled “mpsc_slist_drain”struct mpsc_slist_node mpsc_slist_drain(struct mpsc_slist *q); mpsc_slist_reverse
Section titled “mpsc_slist_reverse”struct mpsc_slist_node mpsc_slist_reverse(struct mpsc_slist_node *chain); mpsc_slist_pop_one
Section titled “mpsc_slist_pop_one”struct mpsc_slist_node mpsc_slist_pop_one(struct mpsc_slist *q); Macros
Section titled “Macros”MPSC_SLIST_INIT
Section titled “MPSC_SLIST_INIT”#define MPSC_SLIST_INIT {NULL} MPSC_SLIST
Section titled “MPSC_SLIST”#define MPSC_SLIST(name) struct mpsc_slist name = MPSC_SLIST_INIT mpsc_slist_entry
Section titled “mpsc_slist_entry”#define mpsc_slist_entry(ptr, type, member) container_of(ptr, type, member) mpsc_slist_for_each
Section titled “mpsc_slist_for_each”#define mpsc_slist_for_each(pos, chain) \
for (pos = (chain); pos; pos = pos->next) mpsc_slist_for_each_safe
Section titled “mpsc_slist_for_each_safe”#define mpsc_slist_for_each_safe(pos, n, chain) \
for (pos = (chain), n = (pos) ? (pos)->next : NULL; pos; \
pos = n, n = (pos) ? (pos)->next : NULL) mpsc_slist_for_each_entry
Section titled “mpsc_slist_for_each_entry”#define mpsc_slist_for_each_entry(pos, chain, member) \
for (pos = (chain) ? mpsc_slist_entry((chain), typeof(*pos), member) \
: NULL; \
pos; \
pos = (pos)->member.next ? mpsc_slist_entry((pos)->member.next, \
typeof(*pos), member) \
: NULL)