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

Function rte_seqcount_read_retry

dpdk/lib/eal/include/rte_seqcount.h:136–157  ·  view source on GitHub ↗

* End a read-side critical section. * * A call to this function marks the end of a read-side critical * section, for @p seqcount. The application must supply the sequence * number produced by the corresponding rte_seqcount_read_begin() call. * * After this function has been called, the caller should not access * the protected data. * * In case rte_seqcount_read_retry() returns true, the j

Source from the content-addressed store, hash-verified

134 * @see rte_seqcount_read_begin()
135 */
136static inline bool
137rte_seqcount_read_retry(const rte_seqcount_t *seqcount, uint32_t begin_sn)
138{
139 uint32_t end_sn;
140
141 /* An odd sequence number means the protected data was being
142 * modified already at the point of the rte_seqcount_read_begin()
143 * call.
144 */
145 if (unlikely(begin_sn & 1))
146 return true;
147
148 /* make sure the data loads happens before the sn load */
149 rte_atomic_thread_fence(rte_memory_order_acquire);
150
151 end_sn = rte_atomic_load_explicit(&seqcount->sn, rte_memory_order_relaxed);
152
153 /* A writer incremented the sequence number during this read
154 * critical section.
155 */
156 return begin_sn != end_sn;
157}
158
159/**
160 * Begin a write-side critical section.

Callers 1

rte_seqlock_read_retryFunction · 0.85

Calls 1

rte_atomic_thread_fenceFunction · 0.50

Tested by

no test coverage detected