5 #ifndef _RTE_TICKETLOCK_H_
6 #define _RTE_TICKETLOCK_H_
43 #define RTE_TICKETLOCK_INITIALIZER { 0 }
55 __atomic_store_n(&tl->tickets, 0, __ATOMIC_RELAXED);
68 uint16_t me = __atomic_fetch_add(&tl->s.next, 1, __ATOMIC_RELAXED);
69 while (__atomic_load_n(&tl->s.current, __ATOMIC_ACQUIRE) != me)
83 uint16_t i = __atomic_load_n(&tl->s.current, __ATOMIC_RELAXED);
84 __atomic_store_n(&tl->s.current, i + 1, __ATOMIC_RELEASE);
100 old.tickets = __atomic_load_n(&tl->tickets, __ATOMIC_RELAXED);
101 new.tickets = old.tickets;
103 if (old.s.next == old.s.current) {
104 if (__atomic_compare_exchange_n(&tl->tickets, &old.tickets,
105 new.tickets, 0, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
125 tic.tickets = __atomic_load_n(&tl->tickets, __ATOMIC_ACQUIRE);
126 return (tic.s.current != tic.s.next);
132 #define TICKET_LOCK_INVALID_ID -1
138 } rte_ticketlock_recursive_t;
143 #define RTE_TICKETLOCK_RECURSIVE_INITIALIZER {RTE_TICKETLOCK_INITIALIZER, \
144 TICKET_LOCK_INVALID_ID, 0}
173 if (__atomic_load_n(&tlr->user, __ATOMIC_RELAXED) !=
id) {
175 __atomic_store_n(&tlr->user,
id, __ATOMIC_RELAXED);
190 if (--(tlr->count) == 0) {
211 if (__atomic_load_n(&tlr->user, __ATOMIC_RELAXED) !=
id) {
214 __atomic_store_n(&tlr->user,
id, __ATOMIC_RELAXED);
#define TICKET_LOCK_INVALID_ID
static __rte_experimental void rte_ticketlock_recursive_unlock(rte_ticketlock_recursive_t *tlr)
static __rte_experimental void rte_ticketlock_lock(rte_ticketlock_t *tl)
static __rte_experimental void rte_ticketlock_unlock(rte_ticketlock_t *tl)
static __rte_experimental void rte_ticketlock_recursive_init(rte_ticketlock_recursive_t *tlr)
static __rte_experimental void rte_ticketlock_init(rte_ticketlock_t *tl)
static __rte_experimental int rte_ticketlock_recursive_trylock(rte_ticketlock_recursive_t *tlr)
static void rte_pause(void)
static __rte_experimental int rte_ticketlock_trylock(rte_ticketlock_t *tl)
static __rte_experimental int rte_ticketlock_is_locked(rte_ticketlock_t *tl)
static __rte_experimental void rte_ticketlock_recursive_lock(rte_ticketlock_recursive_t *tlr)
static int rte_gettid(void)