src/dpdk/lib/librte_eal/include/generic/rte_mcslock.h
static inline void
rte_mcslock_unlock(rte_mcslock_t **msl, rte_mcslock_t *me)
{
	/* Check if there are more nodes in the queue. */
	if (likely(__atomic_load_n(&me->next, __ATOMIC_RELAXED) == NULL)) {
		/* No, last member in the queue. */
		rte_mcslock_t *save_me = __atomic_load_n(&me, __ATOMIC_RELAXED);

		/* Release the lock by setting it to NULL */
		if (likely(__atomic_compare_exchange_n(msl, &save_me, NULL, 0,
				__ATOMIC_RELEASE, __ATOMIC_RELAXED)))
			return;

		/* Speculative execution would be allowed to read in the
		 * while-loop first. This has the potential to cause a
		 * deadlock. Need a load barrier.
		 */
		__atomic_thread_fence(__ATOMIC_ACQUIRE);
		/* More nodes added to the queue by other CPUs.
		 * Wait until the next pointer is set.
		 */
		while (__atomic_load_n(&me->next, __ATOMIC_RELAXED) == NULL)
			rte_pause();
	}

	/* Pass lock to next waiter. */
	__atomic_store_n(&me->next->locked, 0, __ATOMIC_RELEASE);
}
/**
 * Release the MCS lock.
 *
 * @param msl
 *   A pointer to the pointer of a MCS lock.
 * @param me
 *   A pointer to the node of MCS lock passed in rte_mcslock_lock.
 */
Release the MCS lock.
@param msl
A pointer to the pointer of a MCS lock.
@param me
A pointer to the node of MCS lock passed in rte_mcslock_lock.
Release the MCS lock . @param msl A pointer to the pointer of a MCS lock . @param me A pointer to the node of MCS lock passed in rte_mcslock_lock .
static inline void
rte_mcslock_unlock(rte_mcslock_t **msl, rte_mcslock_t *me)
{
	if (likely(__atomic_load_n(&me->next, __ATOMIC_RELAXED) == NULL)) {
		rte_mcslock_t *save_me = __atomic_load_n(&me, __ATOMIC_RELAXED);
		if (likely(__atomic_compare_exchange_n(msl, &save_me, NULL, 0,
				__ATOMIC_RELEASE, __ATOMIC_RELAXED)))
			return;
		__atomic_thread_fence(__ATOMIC_ACQUIRE);
		while (__atomic_load_n(&me->next, __ATOMIC_RELAXED) == NULL)
			rte_pause();
	}
	__atomic_store_n(&me->next->locked, 0, __ATOMIC_RELEASE);
}
static inline void rte_mcslock_unlock ( rte_mcslock_t * * msl , rte_mcslock_t * me ) { if ( likely ( __atomic_load_n ( & me -> next , __ATOMIC_RELAXED ) == NULL ) ) { rte_mcslock_t * save_me = __atomic_load_n ( & me , __ATOMIC_RELAXED ) ; if ( likely ( __atomic_compare_exchange_n ( msl , & save_me , NULL , 0 , __ATOMIC_RELEASE , __ATOMIC_RELAXED ) ) ) return ; __atomic_thread_fence ( __ATOMIC_ACQUIRE ) ; while ( __atomic_load_n ( & me -> next , __ATOMIC_RELAXED ) == NULL ) rte_pause ( ) ; } __atomic_store_n ( & me -> next -> locked , 0 , __ATOMIC_RELEASE ) ; }
Release the MCS lock.
Release the MCS lock .
/* Check if there are more nodes in the queue. */ /* No, last member in the queue. */ /* Release the lock by setting it to NULL */ /* Speculative execution would be allowed to read in the
		 * while-loop first. This has the potential to cause a
		 * deadlock. Need a load barrier.
		 */ /* More nodes added to the queue by other CPUs.
		 * Wait until the next pointer is set.
		 */ /* Pass lock to next waiter. */