]> granicus.if.org Git - libevent/commitdiff
test: cover that after event_del() callback will not be scheduled again
authorAzat Khuzhin <a3at.mail@gmail.com>
Sat, 29 Apr 2017 22:11:31 +0000 (01:11 +0300)
committerAzat Khuzhin <azat@libevent.org>
Sat, 2 Feb 2019 12:13:50 +0000 (15:13 +0300)
Refs: #236
Refs: #225
(cherry picked from commit 5ff83989f30daef93a851c2162667375ed1663a5)

test/regress.c

index dcfb598c73e64104d4e4ffb0d5b26798544898f3..e4ce98c0a593d61221a304bcc97afe69c6d5c790 100644 (file)
@@ -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:
        ;
 }