Imp.wakeup

Can there be multiple imp.wakeup commands waiting in some buffer to run the same routine? I see sometimes I Issue:

imp.wakeup(14,mainloop);

and I catch it double banging, that is mainloop runs then 6s it runs again. I don’t change any code, I just Press Build and Run again and it goes back to 14s . Program is too big to post. If I somehow call a wakeup on the same routine twice, are both of those going to hit eventually? Is there a way to clear any impending wakeups before issuing the new wakeup at the end of mainloop?

Can there be multiple imp.wakeup commands waiting in some buffer to run the same routine?

Yes. If you want subsequent calls to imp.wakeup to override earlier ones, you can wrap it in a function:

`function wakeuponce(timer, s, cb)
{
if (“t” in timer) {
imp.cancelwakeup(timer.t);
delete timer.t;
}
timer.t <- imp.wakeup(s, cb);
}

local mytimer = {};

wakeuponce(mytimer, 14, mainloop);`

Peter

That’s what I was looking for. Thanks.