* Pick off timeout elements from the global queue and call their functions. * Do this until their time is less than or equal to the move count. */
| 2219 | * Do this until their time is less than or equal to the move count. |
| 2220 | */ |
| 2221 | void |
| 2222 | run_timers(void) |
| 2223 | { |
| 2224 | timer_element *curr; |
| 2225 | |
| 2226 | /* |
| 2227 | * Always use the first element. Elements may be added or deleted at |
| 2228 | * any time. The list is ordered; we are done when the first element |
| 2229 | * is in the future. |
| 2230 | */ |
| 2231 | while (gt.timer_base && gt.timer_base->timeout <= svm.moves) { |
| 2232 | curr = gt.timer_base; |
| 2233 | gt.timer_base = curr->next; |
| 2234 | |
| 2235 | if (curr->kind == TIMER_OBJECT) |
| 2236 | (curr->arg.a_obj)->timed--; |
| 2237 | (*timeout_funcs[curr->func_index].f)(&curr->arg, curr->timeout); |
| 2238 | (void) memset((genericptr_t) curr, 0, sizeof(timer_element)); |
| 2239 | free((genericptr_t) curr); |
| 2240 | } |
| 2241 | } |
| 2242 | |
| 2243 | /* |
| 2244 | * Start a timer. Return TRUE if successful. |
no outgoing calls
no test coverage detected