diff options
-rw-r--r-- | common/timer.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/common/timer.h b/common/timer.h index d9ac75ea13..91786aca10 100644 --- a/common/timer.h +++ b/common/timer.h @@ -52,8 +52,24 @@ public: Timer(OSystem *system); ~Timer(); - bool installTimerProc(TimerProc procedure, int32 interval, void *refCon); - void removeTimerProc(TimerProc procedure); + /** + * Install a new timer callback. It will from now be called every interval microseconds. + * The timer may be invoked from a seperate thread. Hence any timer code should be + * written following the same safety guidelines as any other threaded code. + * + * @note Although the interval is specified in microseconds, the actual timer resolution + * may be lower. In particular, with the SDL backend the timer resolution is 10ms. + * @param proc the callback + * @param interval the interval in which the timer shall be invoked (in microseconds) + * @param refCon an arbitrary void pointer; will be passed to the timer callback + * @return true if the timer was installed successfully, false otherwise + */ + bool installTimerProc(TimerProc proc, int32 interval, void *refCon); + + /** + * Remove the given timer callback. It will not be invoked anymore. + */ + void removeTimerProc(TimerProc proc); protected: static int timer_handler(int t); |