Mercurial > MadButterfly
annotate src/timer.c @ 1241:e64f5bd2270c
Change naming.
- key frame should be marked/unmark, not be added/removed to/from a
layer.
- layers are inserted into the stack of layers, not be added.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 10 Jan 2011 13:37:33 +0800 |
parents | 7ccc094bdbe5 |
children |
rev | line source |
---|---|
822
586e50f82c1f
Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents:
186
diff
changeset
|
1 // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- |
586e50f82c1f
Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents:
186
diff
changeset
|
2 // vim: sw=4:ts=8:sts=4 |
39 | 3 #include <stdio.h> |
4 #include <stdint.h> | |
5 #include <stdlib.h> | |
41 | 6 #include <string.h> |
186
530bb7728546
Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents:
185
diff
changeset
|
7 #include "mb_timer.h" |
530bb7728546
Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents:
185
diff
changeset
|
8 #include "mb_tools.h" |
1018
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
9 #include "mb_backend.h" |
39 | 10 |
11 | |
12 #define OK 0 | |
13 #define ERR -1 | |
14 | |
15 struct _mb_timer { | |
41 | 16 mb_timeval_t tmo; |
39 | 17 mb_tmo_hdlr hdlr; |
18 void *arg; | |
19 mb_timer_t *next; | |
20 }; | |
21 | |
22 struct _mb_tman { | |
23 STAILQ(mb_timer_t) timers; | |
24 elmpool_t *timer_pool; | |
25 }; | |
26 | |
27 mb_tman_t *mb_tman_new(void) { | |
28 mb_tman_t *tman; | |
822
586e50f82c1f
Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents:
186
diff
changeset
|
29 |
39 | 30 tman = (mb_tman_t *)malloc(sizeof(mb_tman_t)); |
31 if(tman == NULL) | |
32 return NULL; | |
33 | |
34 tman->timer_pool = elmpool_new(sizeof(mb_timer_t), 32); | |
35 if(tman->timer_pool == NULL) { | |
36 free(tman); | |
37 return NULL; | |
38 } | |
39 | |
40 STAILQ_INIT(tman->timers); | |
41 | |
42 return tman; | |
43 } | |
44 | |
45 void mb_tman_free(mb_tman_t *tman) { | |
46 elmpool_free(tman->timer_pool); | |
47 free(tman); | |
48 } | |
49 | |
50 mb_timer_t *mb_tman_timeout(mb_tman_t *tman, | |
41 | 51 const mb_timeval_t *tmo, |
39 | 52 mb_tmo_hdlr hdlr, void *arg) { |
53 mb_timer_t *timer, *visit, *last; | |
54 | |
55 timer = elmpool_elm_alloc(tman->timer_pool); | |
56 if(timer == NULL) | |
57 return NULL; | |
58 | |
43
6270230b9248
Use MB_TIMEVAL_CP() instead of memcpy
Thinker K.F. Li <thinker@branda.to>
parents:
41
diff
changeset
|
59 MB_TIMEVAL_CP(&timer->tmo, tmo); |
39 | 60 timer->hdlr = hdlr; |
61 timer->arg = arg; | |
62 | |
63 last = NULL; | |
64 for(visit = STAILQ_HEAD(tman->timers); | |
65 visit != NULL; | |
66 visit = STAILQ_NEXT(mb_timer_t, next, visit)) { | |
155
6749f6639924
Fix bug for STAILQ that fail to remove a node.
Thinker K.F. Li <thinker@branda.to>
parents:
50
diff
changeset
|
67 if(MB_TIMEVAL_LATER(&visit->tmo, tmo) || |
6749f6639924
Fix bug for STAILQ that fail to remove a node.
Thinker K.F. Li <thinker@branda.to>
parents:
50
diff
changeset
|
68 MB_TIMEVAL_EQ(&visit->tmo, tmo)) |
39 | 69 break; |
70 last = visit; | |
71 } | |
72 | |
73 if(last == NULL) | |
74 STAILQ_INS(tman->timers, mb_timer_t, next, timer); | |
75 else if(visit == NULL) | |
76 STAILQ_INS_TAIL(tman->timers, mb_timer_t, next, timer); | |
77 else | |
78 STAILQ_INS_AFTER(mb_timer_t, next, timer, last); | |
79 | |
80 return timer; | |
81 } | |
822
586e50f82c1f
Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents:
186
diff
changeset
|
82 |
39 | 83 int mb_tman_remove(mb_tman_t *tman, mb_timer_t *timer) { |
84 STAILQ_REMOVE(tman->timers, mb_timer_t, next, timer); | |
85 elmpool_elm_free(tman->timer_pool, timer); | |
86 | |
87 return OK; | |
88 } | |
89 | |
50 | 90 /*! \brief Get how long to next timeout from this monent. |
91 * | |
92 * \return 0 for having next timeout, -1 for not more timeout. | |
93 */ | |
39 | 94 int mb_tman_next_timeout(mb_tman_t *tman, |
41 | 95 const mb_timeval_t *now, mb_timeval_t *tmo_after) { |
39 | 96 mb_timer_t *timer; |
97 | |
98 timer = STAILQ_HEAD(tman->timers); | |
99 if(timer == NULL) | |
100 return ERR; | |
101 | |
41 | 102 if(!MB_TIMEVAL_LATER(&timer->tmo, now)) { |
103 memset(tmo_after, 0, sizeof(mb_timeval_t)); | |
39 | 104 return OK; |
105 } | |
106 | |
43
6270230b9248
Use MB_TIMEVAL_CP() instead of memcpy
Thinker K.F. Li <thinker@branda.to>
parents:
41
diff
changeset
|
107 MB_TIMEVAL_CP(tmo_after, &timer->tmo); |
41 | 108 MB_TIMEVAL_DIFF(tmo_after, now); |
39 | 109 |
110 return OK; | |
111 } | |
112 | |
41 | 113 int mb_tman_handle_timeout(mb_tman_t *tman, mb_timeval_t *now) { |
39 | 114 mb_timer_t *timer; |
115 | |
116 while((timer = STAILQ_HEAD(tman->timers)) != NULL){ | |
41 | 117 if(MB_TIMEVAL_LATER(&timer->tmo, now)) |
39 | 118 break; |
41 | 119 timer->hdlr(&timer->tmo, now, timer->arg); |
39 | 120 STAILQ_REMOVE(tman->timers, mb_timer_t, next, timer); |
121 elmpool_elm_free(tman->timer_pool, timer); | |
122 } | |
123 | |
124 return OK; | |
125 } | |
1018
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
126 |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
127 /*! \defgroup tman_timer_man Timer manager based on mb_tman_t. |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
128 * |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
129 * This implmentation of timer manager is based on mb_tman_t. |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
130 * @{ |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
131 */ |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
132 struct _tman_timer_man { |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
133 mb_timer_man_t timer_man; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
134 mb_tman_t *tman; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
135 }; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
136 |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
137 static int _tman_timer_man_timeout(struct _mb_timer_man *tm_man, |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
138 mb_timeval_t *tmout, |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
139 mb_timer_cb_t cb, void *data); |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
140 static void _tman_timer_man_remove(struct _mb_timer_man *tm_man, int tm_hdl); |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
141 static mb_timer_man_t *_tman_timer_fact_new(void); |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
142 static void _tman_timer_fact_free(mb_timer_man_t *timer_man); |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
143 |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
144 static struct _tman_timer_man _tman_default_timer_man = { |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
145 {_tman_timer_man_timeout, _tman_timer_man_remove}, |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
146 NULL |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
147 }; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
148 |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
149 mb_timer_factory_t tman_timer_factory = { |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
150 _tman_timer_fact_new, |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
151 _tman_timer_fact_free |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
152 }; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
153 |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
154 /*! \brief Content of a timeout request. |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
155 * |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
156 * This is only used by internal of X support. This data structure |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
157 * carry information to adopt mb_tman_t to mb_timer_man_t. |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
158 */ |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
159 struct _tman_timeout_data { |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
160 mb_timer_t *timer; /*!< Handle returned by mb_tman_timeout() */ |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
161 mb_timer_cb_t cb; /*!< Real callback function */ |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
162 void *data; /*!< data for real callback */ |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
163 }; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
164 |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
165 static void |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
166 _tman_tmo_hdlr(const mb_timeval_t *tmo, |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
167 const mb_timeval_t *now, |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
168 void *arg) { |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
169 struct _tman_timeout_data *data = (struct _tman_timeout_data *)arg; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
170 |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
171 data->cb((int)data, tmo, now, data->data); |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
172 } |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
173 |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
174 static int |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
175 _tman_timer_man_timeout(struct _mb_timer_man *tm_man, |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
176 mb_timeval_t *tmout, /* timeout (wall time) */ |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
177 mb_timer_cb_t cb, void *data) { |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
178 struct _tman_timer_man *timer_man = (struct _tman_timer_man *)tm_man; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
179 mb_timer_t *timer; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
180 struct _tman_timeout_data *tmout_data; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
181 |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
182 tmout_data = O_ALLOC(struct _tman_timeout_data); |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
183 tmout_data->cb = cb; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
184 tmout_data->data = data; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
185 timer = mb_tman_timeout(timer_man->tman, tmout, |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
186 _tman_tmo_hdlr, tmout_data); |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
187 if(timer == NULL) |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
188 return ERR; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
189 tmout_data->timer = timer; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
190 |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
191 return (int)tmout_data; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
192 } |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
193 |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
194 static void |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
195 _tman_timer_man_remove(struct _mb_timer_man *tm_man, int tm_hdl) { |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
196 struct _tman_timer_man *timer_man = (struct _tman_timer_man *)tm_man; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
197 struct _tman_timeout_data *tmout_data = |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
198 (struct _tman_timeout_data *)tm_hdl; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
199 |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
200 mb_tman_remove(timer_man->tman, tmout_data->timer); |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
201 free(tmout_data); |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
202 } |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
203 |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
204 static mb_timer_man_t * |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
205 _tman_timer_fact_new(void) { |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
206 if(_tman_default_timer_man.tman == NULL) |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
207 _tman_default_timer_man.tman = mb_tman_new(); |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
208 return (mb_timer_man_t *)&_tman_default_timer_man; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
209 } |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
210 |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
211 static void |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
212 _tman_timer_fact_free(mb_timer_man_t *timer_man) { |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
213 } |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
214 |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
215 mb_tman_t * |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
216 tman_timer_man_get_tman(mb_timer_man_t *tm_man) { |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
217 struct _tman_timer_man *timer_man = (struct _tman_timer_man *)tm_man; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
218 |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
219 return timer_man->tman; |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
220 } |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
221 |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
222 |
7ccc094bdbe5
Move the timer manager based on mb_tman_t to timer.c
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
223 /* @} */ |