Lockless MPMC LIFO list
include/structures/mpmc_lifo_list.h View source View on GitHubStructs
Section titled “Structs”mpmc_lifo_list_node
Section titled “mpmc_lifo_list_node” struct mpmc_lifo_list_node (1 field) source
§
struct mpmc_lifo_list_node *next mpmc_lifo_list
Section titled “mpmc_lifo_list” struct mpmc_lifo_list (1 field) source
§
atomic_uint128_t head Unions
Section titled “Unions”mpmc_lifo_list_head
Section titled “mpmc_lifo_list_head” union mpmc_lifo_list_head (2 fields) source
Functions
Section titled “Functions”mpmc_lifo_list_cas
Section titled “mpmc_lifo_list_cas”bool mpmc_lifo_list_cas(
struct mpmc_lifo_list *q,
union mpmc_lifo_list_head *expected,
union mpmc_lifo_list_head desired
) source mpmc_lifo_list_load
Section titled “mpmc_lifo_list_load”union mpmc_lifo_list_head mpmc_lifo_list_load(const struct mpmc_lifo_list *q) source mpmc_lifo_list_init
Section titled “mpmc_lifo_list_init”void mpmc_lifo_list_init(struct mpmc_lifo_list *q) source mpmc_lifo_list_empty
Section titled “mpmc_lifo_list_empty”bool mpmc_lifo_list_empty(const struct mpmc_lifo_list *q) source mpmc_lifo_list_seq
Section titled “mpmc_lifo_list_seq”uint64_t mpmc_lifo_list_seq(const struct mpmc_lifo_list *q) source mpmc_lifo_list_peek
Section titled “mpmc_lifo_list_peek”struct mpmc_lifo_list_node * mpmc_lifo_list_peek(const struct mpmc_lifo_list *q) source mpmc_lifo_list_push
Section titled “mpmc_lifo_list_push”bool mpmc_lifo_list_push(
struct mpmc_lifo_list *q,
struct mpmc_lifo_list_node *n
) source true if list was previously empty
mpmc_lifo_list_push_chain
Section titled “mpmc_lifo_list_push_chain”bool mpmc_lifo_list_push_chain(
struct mpmc_lifo_list *q,
struct mpmc_lifo_list_node *first,
struct mpmc_lifo_list_node *last
) source Push a chain [first … last]
mpmc_lifo_list_pop
Section titled “mpmc_lifo_list_pop”struct mpmc_lifo_list_node * mpmc_lifo_list_pop(struct mpmc_lifo_list *q) source MC pop one node in LIFO order
mpmc_lifo_list_drain
Section titled “mpmc_lifo_list_drain”struct mpmc_lifo_list_node * mpmc_lifo_list_drain(struct mpmc_lifo_list *q) source Return entire chain and mark empty
mpmc_lifo_list_reverse
Section titled “mpmc_lifo_list_reverse”struct mpmc_lifo_list_node * mpmc_lifo_list_reverse(struct mpmc_lifo_list_node *chain) source Get the FIFO order
Macros
Section titled “Macros”MPMC_LIFO_LIST_INIT
Section titled “MPMC_LIFO_LIST_INIT”#define MPMC_LIFO_LIST_INIT {.head = 0} source MPMC_LIFO_LIST
Section titled “MPMC_LIFO_LIST”#define MPMC_LIFO_LIST(name) source Expansion
#define MPMC_LIFO_LIST(name) struct mpmc_lifo_list name = MPMC_LIFO_LIST_INIT mpmc_lifo_list_entry
Section titled “mpmc_lifo_list_entry”#define mpmc_lifo_list_entry(ptr, type, member) source Expansion
#define mpmc_lifo_list_entry(ptr, type, member) container_of(ptr, type, member) mpmc_lifo_list_for_each
Section titled “mpmc_lifo_list_for_each”#define mpmc_lifo_list_for_each(pos, chain) source Expansion
#define mpmc_lifo_list_for_each(pos, chain) \
for (pos = (chain); pos; pos = pos->next) mpmc_lifo_list_for_each_safe
Section titled “mpmc_lifo_list_for_each_safe”#define mpmc_lifo_list_for_each_safe(pos, n, chain) source Expansion
#define mpmc_lifo_list_for_each_safe(pos, n, chain) \
for (pos = (chain), n = (pos) ? (pos)->next : NULL; pos; \
pos = n, n = (pos) ? (pos)->next : NULL) mpmc_lifo_list_for_each_entry
Section titled “mpmc_lifo_list_for_each_entry”#define mpmc_lifo_list_for_each_entry(pos, chain, member) source Expansion
#define mpmc_lifo_list_for_each_entry(pos, chain, member) \
for (pos = (chain) ? mpmc_lifo_list_entry((chain), typeof(*pos), member) \
: NULL; \
pos; \
pos = (pos)->member.next ? mpmc_lifo_list_entry((pos)->member.next, \
typeof(*pos), member) \
: NULL) mpmc_lifo_list_for_each_entry_safe
Section titled “mpmc_lifo_list_for_each_entry_safe”#define mpmc_lifo_list_for_each_entry_safe(pos, n, chain, member) source Expansion
#define mpmc_lifo_list_for_each_entry_safe(pos, n, chain, member) \
for (pos = (chain) ? mpmc_lifo_list_entry((chain), typeof(*pos), member) \
: NULL, \
n = (pos && (pos)->member.next) \
? mpmc_lifo_list_entry((pos)->member.next, typeof(*pos), \
member) \
: NULL; \
pos; pos = n, n = (pos && (pos)->member.next) \
? mpmc_lifo_list_entry((pos)->member.next, \
typeof(*pos), member) \
: NULL)