{
timeq_del(0, 0, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_FUNC|TIMEQ_IGNORE_DATA);
heap_delete(timeq);
+ timeq = NULL;
}
-void
+static void
timeq_init(void)
{
timeq = heap_new(int_comparator);
timeq_next(void)
{
void *time;
+ if (!timeq)
+ return ~0;
heap_peek(timeq, &time, 0);
return (time_t)time;
}
ent->func = func;
ent->data = data;
w = (void*)when;
+ if (!timeq)
+ timeq_init();
heap_insert(timeq, w, ent);
}
extra.func = func;
extra.data = data;
extra.mask = mask;
- heap_remove_pred(timeq, timeq_del_matching, &extra);
+ if (timeq)
+ heap_remove_pred(timeq, timeq_del_matching, &extra);
}
unsigned int