{
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, tm->index, 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)
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);
}
}
}
HEAP_INIT(struct elt, heap, n, H_LESS, HEAP_SWAP);
uns nn = n;
while (nn)
- HEAP_DELMIN(struct elt, heap, nn, H_LESS, HEAP_SWAP);
+ HEAP_DELETE_MIN(struct elt, heap, nn, H_LESS, HEAP_SWAP);
#undef H_LESS
}
HEAP_INIT(struct elt *, heap, n, H_LESS, HEAP_SWAP);
uns nn = n;
while (nn)
- HEAP_DELMIN(struct elt *, heap, nn, H_LESS, HEAP_SWAP);
+ HEAP_DELETE_MIN(struct elt *, heap, nn, H_LESS, HEAP_SWAP);
#undef H_LESS
}
q->pri_heap = xrealloc(old_heap, (q->heap_max + 1) * sizeof(struct work *));
}
struct work **heap = q->pri_heap;
- heap[++q->heap_cnt] = w;
- HEAP_INSERT(struct work *, heap, q->heap_cnt, PRI_LESS, HEAP_SWAP);
+ HEAP_INSERT(struct work *, heap, q->heap_cnt, PRI_LESS, HEAP_SWAP, w);
}
pthread_mutex_unlock(&q->queue_mutex);
sem_post(q->queue_sem);
{
struct work **heap = q->pri_heap;
w = heap[1];
- HEAP_DELMIN(struct work *, heap, q->heap_cnt, PRI_LESS, HEAP_SWAP);
+ HEAP_DELETE_MIN(struct work *, heap, q->heap_cnt, PRI_LESS, HEAP_SWAP);
}
pthread_mutex_unlock(&q->queue_mutex);
return w;