~ubuntu-branches/ubuntu/quantal/elinks/quantal

« back to all changes in this revision

Viewing changes to src/main/timer.c

  • Committer: Bazaar Package Importer
  • Author(s): Siegfried-Angel Gevatter Pujals (RainCT)
  • Date: 2008-02-01 16:29:06 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080201162906-xdourui5tyjva0al
Tags: 0.11.3-5ubuntu1
 
* Merge from Debian unstable (LP: #187936); remaining changes:
  - Add X-Ubuntu-Gettext-Domain to .desktop files.
  - debian/control: Maintainer field update.
* Improve the text in the .desktop file and add some translations.
 

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
        void *data;
23
23
};
24
24
 
 
25
/* @timers.next points to the timer with the smallest interval,
 
26
 * @timers.next->next to the second smallest, and so on.  */
25
27
static INIT_LIST_HEAD(timers);
26
28
 
27
29
int
36
38
{
37
39
        timeval_T now;
38
40
        timeval_T interval;
39
 
        struct timer *timer, *next;
 
41
        struct timer *timer;
40
42
 
41
43
        timeval_now(&now);
42
44
        timeval_sub(&interval, last_time, &now);
45
47
                timeval_sub_interval(&timer->interval, &interval);
46
48
        }
47
49
 
48
 
        foreachsafe (timer, next, timers) {
 
50
        while (!list_empty(timers)) {
 
51
                timer = timers.next;
 
52
 
49
53
                if (timeval_is_positive(&timer->interval))
50
54
                        break;
51
55
 
52
56
                del_from_list(timer);
 
57
                /* At this point, *@timer is to be considered invalid
 
58
                 * outside timers.c; if anything e.g. passes it to
 
59
                 * @kill_timer, that's a bug.  However, @timer->func
 
60
                 * and @check_bottom_halves can still call @kill_timer
 
61
                 * on other timers, so this loop must be careful not to
 
62
                 * keep pointers to them.  (bug 868) */
53
63
                timer->func(timer->data);
54
64
                mem_free(timer);
55
65
                check_bottom_halves();