MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rte_ticketlock_recursive_trylock

Function rte_ticketlock_recursive_trylock

dpdk/lib/eal/include/rte_ticketlock.h:198–210  ·  view source on GitHub ↗

* Try to take the recursive lock. * * @param tlr * A pointer to the recursive ticketlock. * @return * 1 if the lock is successfully taken; 0 otherwise. */

Source from the content-addressed store, hash-verified

196 * 1 if the lock is successfully taken; 0 otherwise.
197 */
198static inline int
199rte_ticketlock_recursive_trylock(rte_ticketlock_recursive_t *tlr)
200{
201 int id = rte_gettid();
202
203 if (rte_atomic_load_explicit(&tlr->user, rte_memory_order_relaxed) != id) {
204 if (rte_ticketlock_trylock(&tlr->tl) == 0)
205 return 0;
206 rte_atomic_store_explicit(&tlr->user, id, rte_memory_order_relaxed);
207 }
208 tlr->count++;
209 return 1;
210}
211
212#ifdef __cplusplus
213}

Callers 1

test_ticketlockFunction · 0.85

Calls 2

rte_gettidFunction · 0.85
rte_ticketlock_trylockFunction · 0.85

Tested by 1

test_ticketlockFunction · 0.68