mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-13 22:37:42 -04:00
from trunk: remove pending timeouts on event_base_free
svn:r628
This commit is contained in:
parent
149c5b4306
commit
d5aeeca0e8
@ -22,7 +22,7 @@ Changes in 1.4.1-beta:
|
|||||||
o When building with GCC, use the "format" attribute to verify type correctness of calls to printf-like functions.
|
o When building with GCC, use the "format" attribute to verify type correctness of calls to printf-like functions.
|
||||||
o removed linger from http server socket; reported by Ilya Martynov
|
o removed linger from http server socket; reported by Ilya Martynov
|
||||||
o Rewrite win32.c backend to be O(n lg n) rather than O(n^2)
|
o Rewrite win32.c backend to be O(n lg n) rather than O(n^2)
|
||||||
|
o remove pending timeouts on event_base_free()
|
||||||
|
|
||||||
Changes in 1.4.0-beta:
|
Changes in 1.4.0-beta:
|
||||||
o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr.
|
o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr.
|
||||||
|
8
event.c
8
event.c
@ -229,6 +229,11 @@ event_base_free(struct event_base *base)
|
|||||||
}
|
}
|
||||||
ev = next;
|
ev = next;
|
||||||
}
|
}
|
||||||
|
while ((ev = min_heap_top(&base->timeheap)) != NULL) {
|
||||||
|
event_del(ev);
|
||||||
|
++n_deleted;
|
||||||
|
}
|
||||||
|
|
||||||
if (n_deleted)
|
if (n_deleted)
|
||||||
event_debug(("%s: %d events were still set in base",
|
event_debug(("%s: %d events were still set in base",
|
||||||
__func__, n_deleted));
|
__func__, n_deleted));
|
||||||
@ -236,8 +241,9 @@ event_base_free(struct event_base *base)
|
|||||||
if (base->evsel->dealloc != NULL)
|
if (base->evsel->dealloc != NULL)
|
||||||
base->evsel->dealloc(base, base->evbase);
|
base->evsel->dealloc(base, base->evbase);
|
||||||
|
|
||||||
for (i=0; i < base->nactivequeues; ++i)
|
for (i = 0; i < base->nactivequeues; ++i)
|
||||||
assert(TAILQ_EMPTY(base->activequeues[i]));
|
assert(TAILQ_EMPTY(base->activequeues[i]));
|
||||||
|
|
||||||
assert(min_heap_empty(&base->timeheap));
|
assert(min_heap_empty(&base->timeheap));
|
||||||
min_heap_dtor(&base->timeheap);
|
min_heap_dtor(&base->timeheap);
|
||||||
|
|
||||||
|
@ -770,6 +770,33 @@ test_loopexit(void)
|
|||||||
cleanup_test();
|
cleanup_test();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_loopexit_multiple(void)
|
||||||
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
struct event_base *base;
|
||||||
|
|
||||||
|
setup_test("Loop Multiple exit: ");
|
||||||
|
|
||||||
|
base = event_base_new();
|
||||||
|
|
||||||
|
tv.tv_usec = 0;
|
||||||
|
tv.tv_sec = 1;
|
||||||
|
event_base_loopexit(base, &tv);
|
||||||
|
|
||||||
|
tv.tv_usec = 0;
|
||||||
|
tv.tv_sec = 2;
|
||||||
|
event_base_loopexit(base, &tv);
|
||||||
|
|
||||||
|
event_base_dispatch(base);
|
||||||
|
|
||||||
|
event_base_free(base);
|
||||||
|
|
||||||
|
test_ok = 1;
|
||||||
|
|
||||||
|
cleanup_test();
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
break_cb(int fd, short events, void *arg)
|
break_cb(int fd, short events, void *arg)
|
||||||
{
|
{
|
||||||
@ -1369,6 +1396,8 @@ main (int argc, char **argv)
|
|||||||
test_loopexit();
|
test_loopexit();
|
||||||
test_loopbreak();
|
test_loopbreak();
|
||||||
|
|
||||||
|
test_loopexit_multiple();
|
||||||
|
|
||||||
test_multiple_events_for_same_fd();
|
test_multiple_events_for_same_fd();
|
||||||
|
|
||||||
test_want_only_once();
|
test_want_only_once();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user