* 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
| 134 | * @see rte_seqcount_read_begin() |
| 135 | */ |
| 136 | static inline bool |
| 137 | rte_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. |
no test coverage detected