# HG changeset patch # User Thinker K.F. Li # Date 1290357749 -28800 # Node ID 7a727ba3f441475c40516559c6e033ed7609a4c6 # Parent bc8cfcd40d0e60864cafeb2d66d3f0a5ca916f33 Implement functions of timer manager for X support diff -r bc8cfcd40d0e -r 7a727ba3f441 src/X_supp.c --- a/src/X_supp.c Mon Nov 22 00:42:29 2010 +0800 +++ b/src/X_supp.c Mon Nov 22 00:42:29 2010 +0800 @@ -82,16 +82,52 @@ mb_tman_t *tman; }; -static struct _X_supp_timer_man _X_supp_default_timer_man = { +int _x_supp_timer_man_timeout(struct _mb_timer_man *tm_man, + mbsec_t sec, mbusec_t usec, + mb_timer_cb_t cb, void *data); +void _x_supp_timer_man_remove(struct _mb_timer_man *tm_man, int tm_hdl); +mb_timer_man_t *_x_supp_timer_fact_new(void); +void _x_supp_timer_fact_free(mb_timer_man_t *timer_man); + +static struct _X_supp_timer_man _x_supp_default_timer_man = { {_x_supp_timer_man_timeout, _x_supp_timer_man_remove}, NULL }; -static mb_timer_factory_t _X_supp_default_timer_factory = { - _X_supp_timer_fact_new, - _X_supp_timer_fact_free +static mb_timer_factory_t _x_supp_default_timer_factory = { + _x_supp_timer_fact_new, + _x_supp_timer_fact_free +}; + +static mb_timer_factory_t *_timer_factory = &_x_supp_default_timer_factory; + +static int +_x_supp_timer_man_timeout(struct _mb_timer_man *tm_man, + mbsec_t sec, mbusec_t usec, + mb_timer_cb_t cb, void *data) { + struct _X_supp_timer_man *timer_man = (struct _X_supp_timer_man *)tm_man; + mb_timer_t *timer; + mb_timeval_t tmo; + + timer = mb_tman_timeout(timer_man->tman, &tmo, cb, data); } +static void +_x_supp_timer_man_remove(struct _mb_timer_man *tm_man, int tm_hdl) { +} + +static mb_timer_man_t * +_x_supp_timer_fact_new(void) { + if(_x_supp_default_timer_man.tman == NULL) + _x_supp_default_timer_man.tman = mb_tman_new(); + return (mb_timer_man_t *)&_x_supp_default_timer_man; +} + +static void +_x_supp_timer_fact_free(mb_timer_man_t *timer_man) { +} + + /* @} */ /*! \defgroup x_mb_io IO manager for X.