diff --git a/events/equeue/equeue.c b/events/equeue/equeue.c index d89d5c62f0..942f62cf49 100644 --- a/events/equeue/equeue.c +++ b/events/equeue/equeue.c @@ -114,7 +114,7 @@ void equeue_destroy(equeue_t *q) } } if (es->dtor) { - es->dtor(es + 1); + es->dtor(es + 1); } } // notify background timer diff --git a/events/equeue/tests/tests.c b/events/equeue/tests/tests.c index 547255b2c4..96f1842962 100644 --- a/events/equeue/tests/tests.c +++ b/events/equeue/tests/tests.c @@ -779,6 +779,29 @@ void break_request_cleared_on_timeout(void) equeue_destroy(&q); } +void sibling_test(void) +{ + equeue_t q; + int err = equeue_create(&q, 1024); + test_assert(!err); + + int id0 = equeue_call_in(&q, 1, pass_func, 0); + int id1 = equeue_call_in(&q, 1, pass_func, 0); + int id2 = equeue_call_in(&q, 1, pass_func, 0); + + struct equeue_event *e = q.queue; + + for (; e; e = e->next) { + for (struct equeue_event *s = e->sibling; s; s = s->sibling) { + test_assert(!s->next); + } + } + equeue_cancel(&q, id0); + equeue_cancel(&q, id1); + equeue_cancel(&q, id2); + equeue_destroy(&q); +} + int main() { printf("beginning tests...\n"); @@ -806,7 +829,7 @@ int main() test_run(fragmenting_barrage_test, 20); test_run(multithreaded_barrage_test, 20); test_run(break_request_cleared_on_timeout); - + test_run(sibling_test); printf("done!\n"); return test_failure; }