[erlang-questions] erlang:restart_timer

Chandru chandrashekhar.mullaparthi@REDACTED
Wed Nov 5 19:03:14 CET 2014


On 5 November 2014 13:50, Tony Rogvall <tony@REDACTED> wrote:

> Hi!
>
> From time to time I implement protocols and services that need watch dogs
> and/or retransmit timers.
> I will normally implement this using a BIF timer:
>


> <snip>
>


> I propose a new BIF:
>
>         erlang:restart_timer(Ref, Time) -> false | RemainingTime
>
> This will restart a time if it is active and return the time that remained
> when it was restarted.
> If restart_timer return false either the timer has already time out or the
> reference is not a timer.
>
>
I second this proposal, quite a useful feature to have when implementing
protocols. Fewer lines of code and the code becomes more readable.

Chandru
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20141105/ae174c1c/attachment.htm>


More information about the erlang-questions mailing list