Resettable timer

Sometimes the oneshot timer may need to be set back. For example when we are checking a user’s inactivity that is interrupted by an interaction.

API: timer.reset(handle)

Isn’t it enough to cancel it and create it again?

I think it’s sometimes important to recognise that each tiny added function adds to the size of the engine.

3 Likes

Naturally deletion and re-creation would be sufficient in normal circumstances, but i think -considering the resource consumption- it would be more effective if the internal state of the existing timer would be zeroed. From engine perspective, implementing this function shouldn’t cause big increase in its size.

What do you mean by this? Have you made measurements and found that cancelling and starting a timer is expensive?