Call back user functions with the specified timing

/* Timers are identified by display:timer_id */ typedef long mbtk_timer_id_t; /* Timer callback function return value determines whether the timer continues running after the call */ typedef enum mbtk_timer_res_e { MBTK_TIMER_CONTINUE = 0, MBTK_TIMER_STOP = 1 } mbtk_timer_res_t; /* use thsi value if a timer shouldn't stop repeating */ #define MBTK_TIMER_REPEAT_FOREVER (-2) /* create a timer that calls cb() rep times with at least period seconds in between the calls. The callback gets an user data and the number of calls left to be done. */ mbtk_timer_id_t mbtk_timer_new(mbtk_display_t *disp, long rep, double period, mbtk_timer_res_t (*cb)(long repleft, void *user_data), void *user_data); /* Stop and remove a timer. Returns 0 on success, -1 on error. Error is "invalid tid". */ int mbtk_timer_stop(mbtk_display_t *disp, mbtk_timer_id_t tid); /* Returns the number of iterations left for a timer; may be MBTK_TIMER_REPEAT_FOREVER or -1 on error (invalid tid) */ long mbtk_timer_get_repleft(mbtk_display_t *disp, mbtk_timer_id_t tid);