Periodic wakeup after fixed interval.
A common pattern is that a fiber wakes up periodically to do some work, like this:
while(true) {
do_work()
}
If somehow the deadline is missed <i>n</i> times, because of debugging, or
some other stalled task, the loop is executed <i>n</i> times without sleeping
to
catch up with
t. This burst of iterations is often not required; this
missed deadlines should just be skipped.
One could be tempted to do it this way:
\code
while(true) {
do_work();
}
Timestamp const & t() const noexcept
However, the sleeping may be just more than 100 ms, so the execution drifts away from a strictly 10 Hz.
Using this class, it is easier to skip missed deadlines, if it is more than one. It can be used as follows:
while(true) {
do_work();
w();
}
PeriodicWakeUp(TimeInterval const &interval)
Definition at line 361 of file waiter.h.