Mercurial > MadButterfly
changeset 989:7a727ba3f441 refine_backend_if
Implement functions of timer manager for X support
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 22 Nov 2010 00:42:29 +0800 |
parents | bc8cfcd40d0e |
children | 8dd42310dd79 |
files | src/X_supp.c |
diffstat | 1 files changed, 40 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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.