Changeset 86bf047


Ignore:
Timestamp:
Dec 11, 2008, 4:01:15 PM (12 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
ca1fc33a
Parents:
25cccdc
Message:
Clean up the timer dispatch logic and contract slightly.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • select.c

    rb7bb454 r86bf047  
    4444    while(!g_sequence_iter_is_end(it)) {
    4545        owl_timer *t = g_sequence_get(it);
    46         int remove = 0;
     46        void (*cb)(struct _owl_timer *, void *);
     47        void *data;
    4748
    4849        if(t->time > now)
    4950            break;
    5051
     52        cb = t->callback;
     53        data = t->data;
     54
    5155        /* Reschedule if appropriate */
    5256        if(t->interval > 0) {
    53             t->time = now + t->interval;
    54             g_sequence_sort_changed(it, (GCompareDataFunc)_owl_select_timer_cmp, NULL);
     57          t->time = now + t->interval;
     58          g_sequence_sort_changed(it, (GCompareDataFunc)_owl_select_timer_cmp, NULL);
    5559        } else {
    56             g_sequence_remove(it);
    57             remove = 1;
     60          owl_select_remove_timer(t);
     61          t = NULL;
    5862        }
    5963
    6064        /* Do the callback */
    61         t->callback(t, t->data);
    62 
    63         if (remove) {
    64             owl_free(t);
    65         }
     65        cb(t, data);
     66
    6667        it = g_sequence_get_begin_iter(owl_global_get_timerlist(&g));
    6768    }
Note: See TracChangeset for help on using the changeset viewer.