L4Re Operating System Framework
Interface and Usage Documentation
|
Evaluate an expression for a maximum number of times. More...
#include <poll_timeout_counter.h>
Public Member Functions | |
Poll_timeout_counter (unsigned counter_val) | |
Constructor. | |
void | set (unsigned counter_val) |
Set the counter to a certain value. | |
bool | test (bool expression=true) |
Evaluate the expression for a maximum number of times. | |
bool | timed_out () const |
Indicator if the maximum number of tests was required. | |
Evaluate an expression for a maximum number of times.
A typical use case is testing for a bit change in a hardware register for a maximum number of times (polling). For example:
The following usage is wrong:
This loop would never terminate if the hardware register doesn't change!
Definition at line 36 of file poll_timeout_counter.h.
|
inline |
Constructor.
counter_val | Maximum number of times to repeat the test. |
Definition at line 44 of file poll_timeout_counter.h.
References set().
|
inline |
Set the counter to a certain value.
counter_val | New counter value for maximum number of times to repeat the test. |
Definition at line 55 of file poll_timeout_counter.h.
Referenced by Poll_timeout_counter().
|
inline |
Indicator if the maximum number of tests was required.
true,if | the maximum number of tests was required or if the counter was initialized to zero. |
Definition at line 83 of file poll_timeout_counter.h.