src/dpdk/lib/librte_eal/include/generic/rte_mcslock.h
static inline int
rte_mcslock_trylock(rte_mcslock_t **msl, rte_mcslock_t *me)
{
	/* Init me node */
	__atomic_store_n(&me->next, NULL, __ATOMIC_RELAXED);

	/* Try to lock */
	rte_mcslock_t *expected = NULL;

	/* The lock can be taken only when the queue is empty. Hence,
	 * the compare-exchange operation requires acquire semantics.
	 * The store to me->next above should complete before the node
	 * is visible to other CPUs/threads. Hence, the compare-exchange
	 * operation requires release semantics as well.
	 */
	return __atomic_compare_exchange_n(msl, &expected, me, 0,
			__ATOMIC_ACQ_REL, __ATOMIC_RELAXED);
}
/**
 * Try to take the lock.
 *
 * @param msl
 *   A pointer to the pointer of a MCS lock.
 * @param me
 *   A pointer to a new node of MCS lock.
 * @return
 *   1 if the lock is successfully taken; 0 otherwise.
 */
Try to take the lock.
@param msl
A pointer to the pointer of a MCS lock.
@param me
A pointer to a new node of MCS lock.
@return
1 if the lock is successfully taken; 0 otherwise.
Try to take the lock . @param msl A pointer to the pointer of a MCS lock . @param me A pointer to a new node of MCS lock . @return 1 if the lock is successfully taken ; 0 otherwise .
static inline int
rte_mcslock_trylock(rte_mcslock_t **msl, rte_mcslock_t *me)
{
	__atomic_store_n(&me->next, NULL, __ATOMIC_RELAXED);
	rte_mcslock_t *expected = NULL;
	return __atomic_compare_exchange_n(msl, &expected, me, 0,
			__ATOMIC_ACQ_REL, __ATOMIC_RELAXED);
}
static inline int rte_mcslock_trylock ( rte_mcslock_t * * msl , rte_mcslock_t * me ) { __atomic_store_n ( & me -> next , NULL , __ATOMIC_RELAXED ) ; rte_mcslock_t * expected = NULL ; return __atomic_compare_exchange_n ( msl , & expected , me , 0 , __ATOMIC_ACQ_REL , __ATOMIC_RELAXED ) ; }
Try to take the lock.
Try to take the lock .
/* Init me node */ /* Try to lock */ /* The lock can be taken only when the queue is empty. Hence,
	 * the compare-exchange operation requires acquire semantics.
	 * The store to me->next above should complete before the node
	 * is visible to other CPUs/threads. Hence, the compare-exchange
	 * operation requires release semantics as well.
	 */