Lines Matching defs:timer
107 static void DoTimer(OsTimerPtr timer, CARD32 now);
122 * Compute timeout until next timer, running
128 OsTimerPtr timer;
130 if ((timer = first_timer()) != NULL) {
132 int timeout = timer->expires - now;
138 if (timeout < timer->delta + 250)
247 static inline Bool timer_pending(OsTimerPtr timer) {
248 return !xorg_list_is_empty(&timer->list);
251 /* If time has rewound, re-run every affected timer.
256 OsTimerPtr timer;
263 xorg_list_for_each_entry(timer, &timers, list) {
264 if (timer->expires - now > timer->delta + 250) {
265 DoTimer(timer, now);
273 DoTimer(OsTimerPtr timer, CARD32 now)
277 xorg_list_del(&timer->list);
278 newTime = (*timer->callback) (timer, now, timer->arg);
280 TimerSet(timer, 0, newTime, timer->callback, timer->arg);
286 OsTimerPtr timer;
289 while ((timer = first_timer())) {
290 if ((int) (timer->expires - now) > 0)
292 DoTimer(timer, now);
298 TimerSet(OsTimerPtr timer, int flags, CARD32 millis,
304 if (!timer) {
305 timer = calloc(1, sizeof(struct _OsTimerRec));
306 if (!timer)
308 xorg_list_init(&timer->list);
312 if (timer_pending(timer)) {
313 xorg_list_del(&timer->list);
315 (void) (*timer->callback) (timer, now, timer->arg);
320 return timer;
322 timer->delta = millis - now;
325 timer->delta = millis;
328 timer->expires = millis;
329 timer->callback = func;
330 timer->arg = arg;
338 xorg_list_append(&timer->list, &existing->list);
340 /* Check to see if the timer is ready to run now */
342 DoTimer(timer, now);
345 return timer;
349 TimerForce(OsTimerPtr timer)
354 pending = timer_pending(timer);
356 DoTimer(timer, GetTimeInMillis());
362 TimerCancel(OsTimerPtr timer)
364 if (!timer)
367 xorg_list_del(&timer->list);
372 TimerFree(OsTimerPtr timer)
374 if (!timer)
376 TimerCancel(timer);
377 free(timer);
390 OsTimerPtr timer, tmp;
397 xorg_list_for_each_entry_safe(timer, tmp, &timers, list) {
398 xorg_list_del(&timer->list);
399 free(timer);
437 ScreenSaverTimeoutExpire(OsTimerPtr timer, CARD32 now, void *arg)