Re: timer-start! and timer-schedule!
Takashi Kato 13 Feb 2015 17:52 UTC
> If so, when a task is scheduled by timer-schedule! given a positive
> integer as parameter 'when', Is the elasped milliseconds to start
> the task is measured from the timing at when timer-schedule! called,
> or at when timer-start! called?
It should be when `timer-schedule!` is called. If the task's due is
already passed, then it should be executed immediately after
`timer-start!` is called. (at least, reference implementation is
implemented like that.) But not sure, if this behaviour is ideal or
not.
> In other words I wonder why timer-start! is necessary at all.
> For example, java.util.Timer
> http://docs.oracle.com/javase/8/docs/api/java/util/Timer.html
> has no corresponding method to timer-start!, because it is in action
> immediately after constructed.
Good point. The purpose of `timer-start!` is more for consistency. There
is `timer-stop!` procedure so I thought it might be better to have start
procedure as well. IHO, it's better to let users have more control. I
would like to hear other opinions?
--
_/_/
Takashi Kato
E-mail: xxxxxx@ymail.com