-
-
Notifications
You must be signed in to change notification settings - Fork 274
Description
over night I have been thinking about that.
We implemented the fix it by placing: if (iEnabled) enable();
into Task::setIterations()
.
I am not sure if that is completely right and if it should not be like:
void Task::setIterations(long aIterations) {
if (iEnabled && iIterations == 0) enable();
iSetIterations = iIterations = aIterations;
}
You have to decide if that makes sense . My motivation was:
- if iterations is not 0 there was no problem, so there was no need to do it.
- but more importantly:
enable()
resets theiPreviousMillis
value. But in the case, that the Task is still running, this would destroy the current interval.
I have a Task running. Its Interval is set to 1o.ooo ms. Every 1o seconds the callback is run.
Four seconds after the callback was run, I callTask::setIterations()
this will reset the Value ofiPreviousMillis
in a way that the task is due to run immediately. But it should wait another six seconds.
I placed it before the reset of the Variables so that I have the untouched iIterations
to compare. I think that is OK too.
You wrote that you have placed the fix into Task::set()
too. I Think that was not necessary, before I knew what the Problem was and before there was Task::restart()
I used full Task::set()
as workaround for Task::setIterations()
, because there it worked without any Problems. Although now, looking at the code I cannot understand why.
PS.: great Library, Thank You.