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

Function test_atomic_dec_and_test

dpdk/app/test/test_atomic.c:235–251  ·  view source on GitHub ↗

* rte_atomicXX_dec_and_test() should decrease a 32 bits counter by one and then * test if that counter is equal to 0. It should return true if the counter is 0 * and false if the counter is not 0. * This test checks if the counter is equal to 0 after being atomically * decreased by one. If it is, increase the value of "count" by one which is to * be checked as the result later. */

Source from the content-addressed store, hash-verified

233 * be checked as the result later.
234 */
235static int
236test_atomic_dec_and_test(__rte_unused void *arg)
237{
238 while (rte_atomic32_read(&synchro) == 0)
239 ;
240
241 if (rte_atomic16_dec_and_test(&a16))
242 rte_atomic64_inc(&count);
243
244 if (rte_atomic32_dec_and_test(&a32))
245 rte_atomic64_inc(&count);
246
247 if (rte_atomic64_dec_and_test(&a64))
248 rte_atomic64_inc(&count);
249
250 return 0;
251}
252
253#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_ARM64)
254static rte_int128_t count128;

Callers

nothing calls this directly

Calls 5

rte_atomic32_readFunction · 0.85
rte_atomic64_incFunction · 0.50

Tested by

no test coverage detected