Add a periodic timer #78
Labels
part:core
Affects the core types (`Sender`, `Receiver`, exceptions, etc.)
priority:high
Address this as soon as possible
type:enhancement
New feature or enhancement visitble to users
Milestone
What's needed?
The current timer fires
interval
time after theready()
method was called, but this is not suitable for periodic timers as it will accumulate timer drift over time.We need a timer that will periodically fire every
interval
time.Proposed solution
Extend
Timer
to have aperiodic
option or create a newPeriodicTimer
that will start when the timer is instantiated and will fire periodically everyinterval
time, no matter ifready()
was called or not.If the timer fired several times before
ready()
/consume()
was called, those fires should be queued and returned eventually.Use cases
The resampler needs this.
Alternatives and workarounds
One could use the current
Timer
and account for the time drifting oneself. But for that we need to create a new timer for each period, which is wasteful in terms of resources (allocations) and inconvenient in terms of programming effort.Additional context
The text was updated successfully, but these errors were encountered: