Skip to content
Commit 4121d947 authored by Petr Machata's avatar Petr Machata Committed by David S. Miller
Browse files

selftests: forwarding: lib: Add helpers for busywaiting



The function busywait() is handy as a safety-latched variant of a while
loop. Many selftests deal specifically with counter values, and busywaiting
on them is likely to be rather common (it is not quite common now, but
busywait() has not been around for very long). To facilitate expressing
simply what is tested, introduce two helpers:

- until_counter_is(), which can be used as a predicate passed to
  busywait(), which holds when expression, which is itself passed as an
  argument to until_counter_is(), reaches a desired value.

- busywait_for_counter(), which is useful for waiting until a given counter
  changes "by" (as opposed to "to") a certain amount.

Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent adc6c7ec
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment