comparison src/X_supp.c @ 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
comparison
equal deleted inserted replaced
988:bc8cfcd40d0e 989:7a727ba3f441
80 struct _X_supp_timer_man { 80 struct _X_supp_timer_man {
81 mb_timer_man_t timer_man; 81 mb_timer_man_t timer_man;
82 mb_tman_t *tman; 82 mb_tman_t *tman;
83 }; 83 };
84 84
85 static struct _X_supp_timer_man _X_supp_default_timer_man = { 85 int _x_supp_timer_man_timeout(struct _mb_timer_man *tm_man,
86 mbsec_t sec, mbusec_t usec,
87 mb_timer_cb_t cb, void *data);
88 void _x_supp_timer_man_remove(struct _mb_timer_man *tm_man, int tm_hdl);
89 mb_timer_man_t *_x_supp_timer_fact_new(void);
90 void _x_supp_timer_fact_free(mb_timer_man_t *timer_man);
91
92 static struct _X_supp_timer_man _x_supp_default_timer_man = {
86 {_x_supp_timer_man_timeout, _x_supp_timer_man_remove}, 93 {_x_supp_timer_man_timeout, _x_supp_timer_man_remove},
87 NULL 94 NULL
88 }; 95 };
89 96
90 static mb_timer_factory_t _X_supp_default_timer_factory = { 97 static mb_timer_factory_t _x_supp_default_timer_factory = {
91 _X_supp_timer_fact_new, 98 _x_supp_timer_fact_new,
92 _X_supp_timer_fact_free 99 _x_supp_timer_fact_free
93 } 100 };
101
102 static mb_timer_factory_t *_timer_factory = &_x_supp_default_timer_factory;
103
104 static int
105 _x_supp_timer_man_timeout(struct _mb_timer_man *tm_man,
106 mbsec_t sec, mbusec_t usec,
107 mb_timer_cb_t cb, void *data) {
108 struct _X_supp_timer_man *timer_man = (struct _X_supp_timer_man *)tm_man;
109 mb_timer_t *timer;
110 mb_timeval_t tmo;
111
112 timer = mb_tman_timeout(timer_man->tman, &tmo, cb, data);
113 }
114
115 static void
116 _x_supp_timer_man_remove(struct _mb_timer_man *tm_man, int tm_hdl) {
117 }
118
119 static mb_timer_man_t *
120 _x_supp_timer_fact_new(void) {
121 if(_x_supp_default_timer_man.tman == NULL)
122 _x_supp_default_timer_man.tman = mb_tman_new();
123 return (mb_timer_man_t *)&_x_supp_default_timer_man;
124 }
125
126 static void
127 _x_supp_timer_fact_free(mb_timer_man_t *timer_man) {
128 }
129
94 130
95 /* @} */ 131 /* @} */
96 132
97 /*! \defgroup x_mb_io IO manager for X. 133 /*! \defgroup x_mb_io IO manager for X.
98 * @{ 134 * @{