| 1 | // SPDX-FileCopyrightText: 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 2 | // |
| 3 | // SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 | |
| 5 | /* |
| 6 | * Userspace RCU library - Stack with wait-free push, blocking traversal. |
| 7 | */ |
| 8 | |
| 9 | /* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */ |
| 10 | #include "urcu/wfstack.h" |
| 11 | #include "urcu/static/wfstack.h" |
| 12 | |
| 13 | /* |
| 14 | * library wrappers to be used by non-LGPL compatible source code. |
| 15 | */ |
| 16 | |
| 17 | void cds_wfs_node_init(struct cds_wfs_node *node) |
| 18 | { |
| 19 | _cds_wfs_node_init(node); |
| 20 | } |
| 21 | |
| 22 | void cds_wfs_init(struct cds_wfs_stack *s) |
| 23 | { |
| 24 | _cds_wfs_init(s); |
| 25 | } |
| 26 | |
| 27 | void cds_wfs_destroy(struct cds_wfs_stack *s) |
| 28 | { |
| 29 | _cds_wfs_destroy(s); |
| 30 | } |
| 31 | |
| 32 | void __cds_wfs_init(struct __cds_wfs_stack *s) |
| 33 | { |
| 34 | ___cds_wfs_init(s); |
| 35 | } |
| 36 | |
| 37 | bool cds_wfs_empty(cds_wfs_stack_const_ptr_t u_stack) |
| 38 | { |
| 39 | return _cds_wfs_empty(u_stack); |
| 40 | } |
| 41 | |
| 42 | int cds_wfs_push(cds_wfs_stack_ptr_t u_stack, struct cds_wfs_node *node) |
| 43 | { |
| 44 | return _cds_wfs_push(u_stack, node); |
| 45 | } |
| 46 | |
| 47 | struct cds_wfs_node *cds_wfs_pop_blocking(struct cds_wfs_stack *s) |
| 48 | { |
| 49 | return _cds_wfs_pop_blocking(s); |
| 50 | } |
| 51 | |
| 52 | struct cds_wfs_node * |
| 53 | cds_wfs_pop_with_state_blocking(struct cds_wfs_stack *s, int *state) |
| 54 | { |
| 55 | return _cds_wfs_pop_with_state_blocking(s, state); |
| 56 | } |
| 57 | |
| 58 | struct cds_wfs_head *cds_wfs_pop_all_blocking(struct cds_wfs_stack *s) |
| 59 | { |
| 60 | return _cds_wfs_pop_all_blocking(s); |
| 61 | } |
| 62 | |
| 63 | struct cds_wfs_node *cds_wfs_first(struct cds_wfs_head *head) |
| 64 | { |
| 65 | return _cds_wfs_first(head); |
| 66 | } |
| 67 | |
| 68 | struct cds_wfs_node *cds_wfs_next_blocking(struct cds_wfs_node *node) |
| 69 | { |
| 70 | return _cds_wfs_next_blocking(node); |
| 71 | } |
| 72 | |
| 73 | struct cds_wfs_node *cds_wfs_next_nonblocking(struct cds_wfs_node *node) |
| 74 | { |
| 75 | return _cds_wfs_next_nonblocking(node); |
| 76 | } |
| 77 | |
| 78 | void cds_wfs_pop_lock(struct cds_wfs_stack *s) |
| 79 | { |
| 80 | _cds_wfs_pop_lock(s); |
| 81 | } |
| 82 | |
| 83 | void cds_wfs_pop_unlock(struct cds_wfs_stack *s) |
| 84 | { |
| 85 | _cds_wfs_pop_unlock(s); |
| 86 | } |
| 87 | |
| 88 | struct cds_wfs_node *__cds_wfs_pop_blocking(cds_wfs_stack_ptr_t u_stack) |
| 89 | { |
| 90 | return ___cds_wfs_pop_blocking(u_stack); |
| 91 | } |
| 92 | |
| 93 | struct cds_wfs_node * |
| 94 | __cds_wfs_pop_with_state_blocking(cds_wfs_stack_ptr_t u_stack, |
| 95 | int *state) |
| 96 | { |
| 97 | return ___cds_wfs_pop_with_state_blocking(u_stack, state); |
| 98 | } |
| 99 | |
| 100 | struct cds_wfs_node *__cds_wfs_pop_nonblocking(cds_wfs_stack_ptr_t u_stack) |
| 101 | { |
| 102 | return ___cds_wfs_pop_nonblocking(u_stack); |
| 103 | } |
| 104 | |
| 105 | struct cds_wfs_node * |
| 106 | __cds_wfs_pop_with_state_nonblocking(cds_wfs_stack_ptr_t u_stack, |
| 107 | int *state) |
| 108 | { |
| 109 | return ___cds_wfs_pop_with_state_nonblocking(u_stack, state); |
| 110 | } |
| 111 | |
| 112 | struct cds_wfs_head *__cds_wfs_pop_all(cds_wfs_stack_ptr_t u_stack) |
| 113 | { |
| 114 | return ___cds_wfs_pop_all(u_stack); |
| 115 | } |