Problem restarting HiResTimer (all platforms ?)


(This post has initially been posted on Android forum but seems to be generic to all platforms. I state it here for the record)

I am running on the Mac for the Mac platform using a HighResolutionTimer-derived class.

It seems that the startTimer(int) routine does not work when I re-launch it from the hiResTimerCallback method (to merely change the callback delay). The same happens on an Android platform (please see for more details).

The same code works fine if I use a regular Timer class.


TBH I never expected people to do housekeeping like that from the timer thread itself - I designed it more as a real-time class where you'd just do some minimal amount of work on the callback and control it from another thread.

But it's not hard to make it cope with that - I've changed it now so hopefully it should work ok.


It does work just like a regular Timer now. Thank you.

And yes, I am far from being as good as you Julian to organize my code.

But you did say


        It's perfectly ok to call startTimer() or stopTimer() from within this

        callback to change the subsequent intervals.


in the callback code. So I was assuming I could do it the way I did.

Thanks for the fast fix anyway.


Drat, the comments do say that! My mistake! (I clearly cut + pasted the comments from the Timer class..)

Well, it works as advertised now - thanks for letting me know!