test: cover that after event_del() callback will not be scheduled again

Refs: #236
Refs: #225
(cherry picked from commit 5ff83989f30daef93a851c2162667375ed1663a5)
This commit is contained in:
Azat Khuzhin 2017-04-30 01:11:31 +03:00 committed by Azat Khuzhin
parent 5dbcae8578
commit 23db747652
No known key found for this signature in database
GPG Key ID: B86086848EF8686D

View 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:
;
}