X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fmainloop.c;h=b5e54965bb87de3e8fab2b3ba877b4c491553832;hb=92b3bd34e6024ec20c67e3c1285f3a442fe6f326;hp=6eb60d47da74a73fa48813e5f26c6074f5c86e77;hpb=e460f9a21d0af5b082f934fe0542baaf14f94b93;p=libucw.git diff --git a/ucw/mainloop.c b/ucw/mainloop.c index 6eb60d47..b5e54965 100644 --- a/ucw/mainloop.c +++ b/ucw/mainloop.c @@ -9,12 +9,13 @@ #undef LOCAL_DEBUG -#include "ucw/lib.h" -#include "ucw/heap.h" -#include "ucw/mainloop.h" -#include "ucw/threads.h" -#include "ucw/gary.h" -#include "ucw/process.h" +#include +#include +#include +#include +#include +#include +#include #include #include @@ -259,13 +260,13 @@ timer_add(struct main_timer *tm, timestamp_t expires) { tm->expires = expires; tm->index = num_timers + 1; - *GARY_PUSH(m->timer_table, 1) = tm; - HEAP_INSERT(struct main_timer *, m->timer_table, tm->index, MAIN_TIMER_LESS, MAIN_TIMER_SWAP); + GARY_RESIZE(m->timer_table, num_timers + 2); + HEAP_INSERT(struct main_timer *, m->timer_table, num_timers, MAIN_TIMER_LESS, MAIN_TIMER_SWAP, tm); } else { tm->expires = expires; - HEAP_INCREASE(struct main_timer *, m->timer_table, num_timers, MAIN_TIMER_LESS, MAIN_TIMER_SWAP, tm->index); + HEAP_INCREASE(struct main_timer *, m->timer_table, num_timers, MAIN_TIMER_LESS, MAIN_TIMER_SWAP, tm->index, tm); } } else if (tm->expires > expires) @@ -281,7 +282,7 @@ timer_add(struct main_timer *tm, timestamp_t expires) else { tm->expires = expires; - HEAP_DECREASE(struct main_timer *, m->timer_table, num_timers, MAIN_TIMER_LESS, MAIN_TIMER_SWAP, tm->index); + HEAP_DECREASE(struct main_timer *, m->timer_table, num_timers, MAIN_TIMER_LESS, MAIN_TIMER_SWAP, tm->index, tm); } } }