From e765e42eb9d11831d770c2eddbaf4c1bd936c694 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Fri, 25 Nov 2016 17:28:15 +0100 Subject: [PATCH] Verify that a timer can be stopped *before* uev_run() Signed-off-by: Joachim Nilsson --- tests/active.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/active.c b/tests/active.c index 78da403..dabcc1e 100644 --- a/tests/active.c +++ b/tests/active.c @@ -8,6 +8,7 @@ uev_t timer1; uev_t timer2; +uev_t timer3; uev_t cron1; uev_t cron2; @@ -16,6 +17,7 @@ static void cb(uev_t *w, void *UNUSED(arg), int UNUSED(events)) fail_unless(w == &timer1); fail_unless(uev_timer_active(&timer2)); + fail_unless(!uev_timer_active(&timer3)); fail_unless(uev_cron_active(&cron1)); fail_unless(uev_cron_active(&cron2)); @@ -39,6 +41,8 @@ int main(void) uev_init(&ctx); uev_timer_init(&ctx, &timer1, cb, NULL, TIMEOUT1 * 1000, 0); uev_timer_init(&ctx, &timer2, cb, NULL, TIMEOUT2 * 1000, 0); + uev_timer_init(&ctx, &timer3, cb, NULL, TIMEOUT2 * 1000, 0); + uev_timer_stop(&timer3); uev_cron_init(&ctx, &cron1, cb, NULL, tomorrow.tv_sec, 24 * 60 * 60); uev_cron_init(&ctx, &cron2, cb, NULL, tomorrow.tv_sec, 24 * 60 * 60);