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

Function rte_pflock_read_lock

dpdk/lib/eal/include/rte_pflock.h:102–118  ·  view source on GitHub ↗

* Take a pflock for read. * * @param pf * A pointer to a pflock structure. */

Source from the content-addressed store, hash-verified

100 * A pointer to a pflock structure.
101 */
102static inline void
103rte_pflock_read_lock(rte_pflock_t *pf)
104{
105 uint16_t w;
106
107 /*
108 * If no writer is present, then the operation has completed
109 * successfully.
110 */
111 w = rte_atomic_fetch_add_explicit(&pf->rd.in, RTE_PFLOCK_RINC, rte_memory_order_acquire)
112 & RTE_PFLOCK_WBITS;
113 if (w == 0)
114 return;
115
116 /* Wait for current write phase to complete. */
117 RTE_WAIT_UNTIL_MASKED(&pf->rd.in, RTE_PFLOCK_WBITS, !=, w, rte_memory_order_acquire);
118}
119
120/**
121 * Release a pflock locked for reading.

Callers 2

test_pflock_per_coreFunction · 0.85
load_loop_fnFunction · 0.85

Calls

no outgoing calls

Tested by 2

test_pflock_per_coreFunction · 0.68
load_loop_fnFunction · 0.68