5 #ifndef _RTE_TICKETLOCK_H_ 6 #define _RTE_TICKETLOCK_H_ 42 #define RTE_TICKETLOCK_INITIALIZER { 0 } 53 __atomic_store_n(&tl->tickets, 0, __ATOMIC_RELAXED);
65 uint16_t me = __atomic_fetch_add(&tl->s.next, 1, __ATOMIC_RELAXED);
78 uint16_t i = __atomic_load_n(&tl->s.current, __ATOMIC_RELAXED);
79 __atomic_store_n(&tl->s.current, i + 1, __ATOMIC_RELEASE);
94 oldl.tickets = __atomic_load_n(&tl->tickets, __ATOMIC_RELAXED);
95 newl.tickets = oldl.tickets;
97 if (oldl.s.next == oldl.s.current) {
98 if (__atomic_compare_exchange_n(&tl->tickets, &oldl.tickets,
99 newl.tickets, 0, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
118 tic.tickets = __atomic_load_n(&tl->tickets, __ATOMIC_ACQUIRE);
119 return (tic.s.current != tic.s.next);
125 #define TICKET_LOCK_INVALID_ID -1 131 } rte_ticketlock_recursive_t;
136 #define RTE_TICKETLOCK_RECURSIVE_INITIALIZER {RTE_TICKETLOCK_INITIALIZER, \ 137 TICKET_LOCK_INVALID_ID, 0} 164 if (__atomic_load_n(&tlr->user, __ATOMIC_RELAXED) !=
id) {
166 __atomic_store_n(&tlr->user,
id, __ATOMIC_RELAXED);
180 if (--(tlr->count) == 0) {
200 if (__atomic_load_n(&tlr->user, __ATOMIC_RELAXED) !=
id) {
203 __atomic_store_n(&tlr->user,
id, __ATOMIC_RELAXED);
static void rte_ticketlock_lock(rte_ticketlock_t *tl)
#define TICKET_LOCK_INVALID_ID
static void rte_ticketlock_recursive_unlock(rte_ticketlock_recursive_t *tlr)
static int rte_ticketlock_is_locked(rte_ticketlock_t *tl)
static void rte_ticketlock_init(rte_ticketlock_t *tl)
static int rte_ticketlock_recursive_trylock(rte_ticketlock_recursive_t *tlr)
static void rte_ticketlock_recursive_init(rte_ticketlock_recursive_t *tlr)
static void rte_ticketlock_unlock(rte_ticketlock_t *tl)
static int rte_ticketlock_trylock(rte_ticketlock_t *tl)
static void rte_ticketlock_recursive_lock(rte_ticketlock_recursive_t *tlr)
static __rte_always_inline void rte_wait_until_equal_16(volatile uint16_t *addr, uint16_t expected, int memorder)
static int rte_gettid(void)