assert(timer_list_time_to_expire(&tlist) == PR_INTERVAL_NO_TIMEOUT);
assert(timer_list_time_to_expire_ms(&tlist) == ~((uint32_t)0));
+ /*
+ * Check changing of interval
+ */
+ timer_list_fn1_called = 0;
+ tlist_entry = timer_list_add(&tlist, LONG_TIMEOUT, timer_list_fn1, &timer_list_fn1_called, timer_list_fn1);
+ assert(tlist_entry != NULL);
+ assert(timer_list_entry_set_interval(&tlist, tlist_entry, SHORT_TIMEOUT) == 0);
+ (void)poll(NULL, 0, SHORT_TIMEOUT);
+ assert(timer_list_time_to_expire(&tlist) == 0);
+ assert(timer_list_time_to_expire_ms(&tlist) == 0);
+ timer_list_expire(&tlist);
+ assert(timer_list_fn1_called == 1);
+
/*
* Test speed and more entries
*/
assert(timer_list_debug_is_valid_heap(&tlist));
assert(tlist.size == i + 1);
assert(tlist.entries[0] == tlist_entry_small);
+ assert(timer_list_entry_get_interval(tlist_entry_small) == SHORT_TIMEOUT);
/*
* Remove all items
assert(timer_list_debug_is_valid_heap(&tlist));
assert(tlist.entries[0] == tlist_entry_small);
+ assert(timer_list_entry_get_interval(tlist_entry[i]) == LONG_TIMEOUT * (i + 1));
}
/*
timer_list_init(tlist);
}
+
+PRUint32
+timer_list_entry_get_interval(const struct timer_list_entry *entry)
+{
+
+ return (entry->interval);
+}
+
+int
+timer_list_entry_set_interval(struct timer_list *tlist, struct timer_list_entry *entry,
+ PRUint32 interval)
+{
+
+ if (interval < 1 || interval > TIMER_LIST_MAX_INTERVAL) {
+ return (-1);
+ }
+
+ if (!entry->is_active) {
+ return (-1);
+ }
+
+ timer_list_heap_delete(tlist, entry);
+
+ entry->interval = interval;
+ entry->epoch = PR_IntervalNow();
+
+ timer_list_insert_into_list(tlist, entry);
+
+ return (0);
+}
extern int timer_list_debug_is_valid_heap(struct timer_list *tlist);
+extern PRUint32 timer_list_entry_get_interval(
+ const struct timer_list_entry *entry);
+
+extern int timer_list_entry_set_interval(
+ struct timer_list *tlist, struct timer_list_entry *entry, PRUint32 interval);
+
#ifdef __cplusplus
}
#endif