Lockless MPSC LIFO list
include/structures/mpsc_lifo_list.h View source View on GitHubStructs
Section titled “Structs”mpsc_lifo_list_node
Section titled “mpsc_lifo_list_node” struct mpsc_lifo_list_node (1 field) source
§
struct mpsc_lifo_list_node *next mpsc_lifo_list
Section titled “mpsc_lifo_list” struct mpsc_lifo_list (1 field) source
§
atomic(struct mpsc_lifo_list_node *) head Functions
Section titled “Functions”mpsc_lifo_list_init
Section titled “mpsc_lifo_list_init”void mpsc_lifo_list_init(struct mpsc_lifo_list *q) source mpsc_lifo_list_empty
Section titled “mpsc_lifo_list_empty”int mpsc_lifo_list_empty(const struct mpsc_lifo_list *q) source mpsc_lifo_list_push
Section titled “mpsc_lifo_list_push”bool mpsc_lifo_list_push(
struct mpsc_lifo_list *q,
struct mpsc_lifo_list_node *n
) source Returns true if list was previously empty
mpsc_lifo_list_drain
Section titled “mpsc_lifo_list_drain”struct mpsc_lifo_list_node * mpsc_lifo_list_drain(struct mpsc_lifo_list *q) source Return the entire chain and mark as empty
mpsc_lifo_list_reverse
Section titled “mpsc_lifo_list_reverse”struct mpsc_lifo_list_node * mpsc_lifo_list_reverse(struct mpsc_lifo_list_node *chain) source Reverse a detached chain to get the FIFO list order
mpsc_lifo_list_pop
Section titled “mpsc_lifo_list_pop”struct mpsc_lifo_list_node * mpsc_lifo_list_pop(struct mpsc_lifo_list *q) source Single consumer pop
Macros
Section titled “Macros”MPSC_LIFO_LIST_INIT
Section titled “MPSC_LIFO_LIST_INIT”#define MPSC_LIFO_LIST_INIT {NULL} source MPSC_LIFO_LIST
Section titled “MPSC_LIFO_LIST”#define MPSC_LIFO_LIST(name) source Expansion
#define MPSC_LIFO_LIST(name) struct mpsc_lifo_list name = MPSC_LIFO_LIST_INIT mpsc_lifo_list_entry
Section titled “mpsc_lifo_list_entry”#define mpsc_lifo_list_entry(ptr, type, member) source Expansion
#define mpsc_lifo_list_entry(ptr, type, member) container_of(ptr, type, member) mpsc_lifo_list_for_each
Section titled “mpsc_lifo_list_for_each”#define mpsc_lifo_list_for_each(pos, chain) source Detached chain
Expansion
#define mpsc_lifo_list_for_each(pos, chain) \
for (pos = (chain); pos; pos = pos->next) mpsc_lifo_list_for_each_safe
Section titled “mpsc_lifo_list_for_each_safe”#define mpsc_lifo_list_for_each_safe(pos, n, chain) source Expansion
#define mpsc_lifo_list_for_each_safe(pos, n, chain) \
for (pos = (chain), n = (pos) ? (pos)->next : NULL; pos; \
pos = n, n = (pos) ? (pos)->next : NULL) mpsc_lifo_list_for_each_entry
Section titled “mpsc_lifo_list_for_each_entry”#define mpsc_lifo_list_for_each_entry(pos, chain, member) source Expansion
#define mpsc_lifo_list_for_each_entry(pos, chain, member) \
for (pos = (chain) ? mpsc_lifo_list_entry((chain), typeof(*pos), member) \
: NULL; \
pos; \
pos = (pos)->member.next ? mpsc_lifo_list_entry((pos)->member.next, \
typeof(*pos), member) \
: NULL)