5 #ifndef _RTE_MCSLOCK_H_ 6 #define _RTE_MCSLOCK_H_ 56 __atomic_store_n(&me->locked, 1, __ATOMIC_RELAXED);
57 __atomic_store_n(&me->next, NULL, __ATOMIC_RELAXED);
65 prev = __atomic_exchange_n(msl, me, __ATOMIC_ACQ_REL);
66 if (
likely(prev == NULL)) {
79 __atomic_store_n(&prev->next, me, __ATOMIC_RELEASE);
85 __atomic_thread_fence(__ATOMIC_ACQ_REL);
91 while (__atomic_load_n(&me->locked, __ATOMIC_ACQUIRE))
111 if (
likely(__atomic_load_n(&me->next, __ATOMIC_RELAXED) == NULL)) {
113 rte_mcslock_t *save_me = __atomic_load_n(&me, __ATOMIC_RELAXED);
116 if (
likely(__atomic_compare_exchange_n(msl, &save_me, NULL, 0,
117 __ATOMIC_RELEASE, __ATOMIC_RELAXED)))
124 __atomic_thread_fence(__ATOMIC_ACQUIRE);
128 while (__atomic_load_n(&me->next, __ATOMIC_RELAXED) == NULL)
133 __atomic_store_n(&me->next->locked, 0, __ATOMIC_RELEASE);
154 __atomic_store_n(&me->next, NULL, __ATOMIC_RELAXED);
165 return __atomic_compare_exchange_n(msl, &expected, me, 0,
166 __ATOMIC_ACQ_REL, __ATOMIC_RELAXED);
184 return (__atomic_load_n(&msl, __ATOMIC_RELAXED) != NULL);
static __rte_experimental int rte_mcslock_is_locked(rte_mcslock_t *msl)
static __rte_experimental void rte_mcslock_unlock(rte_mcslock_t **msl, rte_mcslock_t *me)
struct rte_mcslock rte_mcslock_t
static __rte_experimental int rte_mcslock_trylock(rte_mcslock_t **msl, rte_mcslock_t *me)
static void rte_pause(void)
static __rte_experimental void rte_mcslock_lock(rte_mcslock_t **msl, rte_mcslock_t *me)