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

Function test_atomic_inc_and_test

dpdk/app/test/test_atomic.c:208–225  ·  view source on GitHub ↗

* rte_atomic32_inc_and_test() would increase a 32 bits counter by one and then * test if that counter is equal to 0. It would return true if the counter is 0 * and false if the counter is not 0. rte_atomic64_inc_and_test() could do the * same thing but for a 64 bits counter. * Here checks that if the 32/64 bits counter is equal to 0 after being atomically * increased by one. If it is, increas

Source from the content-addressed store, hash-verified

206 *
207 */
208static int
209test_atomic_inc_and_test(__rte_unused void *arg)
210{
211 while (rte_atomic32_read(&synchro) == 0)
212 ;
213
214 if (rte_atomic16_inc_and_test(&a16)) {
215 rte_atomic64_inc(&count);
216 }
217 if (rte_atomic32_inc_and_test(&a32)) {
218 rte_atomic64_inc(&count);
219 }
220 if (rte_atomic64_inc_and_test(&a64)) {
221 rte_atomic64_inc(&count);
222 }
223
224 return 0;
225}
226
227/*
228 * rte_atomicXX_dec_and_test() should decrease a 32 bits counter by one and then

Callers

nothing calls this directly

Calls 5

rte_atomic32_readFunction · 0.85
rte_atomic64_incFunction · 0.50

Tested by

no test coverage detected