summaryrefslogtreecommitdiff
path: root/event.c
diff options
context:
space:
mode:
authorChristopher Davis <chrisd@torproject.org>2010-08-28 02:08:27 -0700
committerChristopher Davis <chrisd@torproject.org>2010-09-08 01:22:21 -0700
commitd844242f9b138be4896942ded25d74a91bf29901 (patch)
tree5edb40d6cb73b0638802e961c0265ba3be1532e1 /event.c
parent03afa209de96d67f1a4b935460aeabe63f5ef24f (diff)
downloadlibevent-d844242f9b138be4896942ded25d74a91bf29901.tar.gz
Stop IOCP when freeing the event_base.
Diffstat (limited to 'event.c')
-rw-r--r--event.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/event.c b/event.c
index dbf1c2f3..5f4656fb 100644
--- a/event.c
+++ b/event.c
@@ -639,6 +639,20 @@ event_base_start_iocp(struct event_base *base)
}
void
+event_base_stop_iocp(struct event_base *base)
+{
+#ifdef WIN32
+ int rv;
+
+ if (!base->iocp)
+ return;
+ rv = event_iocp_shutdown(base->iocp, -1);
+ EVUTIL_ASSERT(rv >= 0);
+ base->iocp = NULL;
+#endif
+}
+
+void
event_base_free(struct event_base *base)
{
int i, n_deleted=0;
@@ -654,6 +668,10 @@ event_base_free(struct event_base *base)
/* XXX(niels) - check for internal events first */
EVUTIL_ASSERT(base);
+#ifdef WIN32
+ event_base_stop_iocp(base);
+#endif
+
/* threading fds if we have them */
if (base->th_notify_fd[0] != -1) {
event_del(&base->th_notify);