From 23db747652a90b49ca699ef64dcbdd1b60447fe3 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Sun, 30 Apr 2017 01:11:31 +0300 Subject: [PATCH] test: cover that after event_del() callback will not be scheduled again Refs: #236 Refs: #225 (cherry picked from commit 5ff83989f30daef93a851c2162667375ed1663a5) --- test/regress.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/regress.c b/test/regress.c index dcfb598c..e4ce98c0 100644 --- a/test/regress.c +++ b/test/regress.c @@ -997,9 +997,9 @@ static void del_wait_cb(evutil_socket_t fd, short event, void *arg) { struct timeval delay = { 0, 300*1000 }; - TT_BLATHER(("Sleeping")); + TT_BLATHER(("Sleeping: %i", test_ok)); evutil_usleep_(&delay); - test_ok = 1; + ++test_ok; } static void @@ -1010,7 +1010,7 @@ test_del_wait(void) setup_test("event_del will wait: "); - event_set(&ev, pair[1], EV_READ, del_wait_cb, &ev); + event_set(&ev, pair[1], EV_READ|EV_PERSIST, del_wait_cb, &ev); event_add(&ev, NULL); pthread_create(&thread, NULL, del_wait_thread, NULL); @@ -1034,6 +1034,8 @@ test_del_wait(void) pthread_join(thread, NULL); + tt_int_op(test_ok, ==, 1); + end: ; } -- 2.40.0