summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ev.c17
-rw-r--r--ev_vars.h4
-rw-r--r--ev_wrap.h2
3 files changed, 21 insertions, 2 deletions
diff --git a/ev.c b/ev.c
index c4cdba8..57c7dc3 100644
--- a/ev.c
+++ b/ev.c
@@ -670,9 +670,12 @@ typedef struct
#if EV_USE_EPOLL
unsigned int egen; /* generation counter to counter epoll bugs */
#endif
-#if EV_SELECT_IS_WINSOCKET
+#if EV_SELECT_IS_WINSOCKET || EV_USE_IOCP
SOCKET handle;
#endif
+#if EV_USE_IOCP
+ OVERLAPPED or, ow;
+#endif
} ANFD;
/* stores the pending event set for a given watcher */
@@ -977,12 +980,13 @@ fd_reify (EV_P)
anfd->reify = 0;
-#if EV_SELECT_IS_WINSOCKET
+#if EV_SELECT_IS_WINSOCKET || EV_USE_IOCP
if (o_reify & EV__IOFDSET)
{
unsigned long arg;
anfd->handle = EV_FD_TO_WIN32_HANDLE (fd);
assert (("libev: only socket fds supported in this configuration", ioctlsocket (anfd->handle, FIONREAD, &arg) == 0));
+ printf ("oi %d %x\n", fd, anfd->handle);//D
}
#endif
@@ -1491,6 +1495,9 @@ childcb (EV_P_ ev_signal *sw, int revents)
/*****************************************************************************/
+#if EV_USE_IOCP
+# include "ev_iocp.c"
+#endif
#if EV_USE_PORT
# include "ev_port.c"
#endif
@@ -1697,6 +1704,9 @@ loop_init (EV_P_ unsigned int flags)
if (!(flags & 0x0000ffffU))
flags |= ev_recommended_backends ();
+#if EV_USE_IOCP
+ if (!backend && (flags & EVBACKEND_IOCP )) backend = iocp_init (EV_A_ flags);
+#endif
#if EV_USE_PORT
if (!backend && (flags & EVBACKEND_PORT )) backend = port_init (EV_A_ flags);
#endif
@@ -1758,6 +1768,9 @@ loop_destroy (EV_P)
if (backend_fd >= 0)
close (backend_fd);
+#if EV_USE_IOCP
+ if (backend == EVBACKEND_IOCP ) iocp_destroy (EV_A);
+#endif
#if EV_USE_PORT
if (backend == EVBACKEND_PORT ) port_destroy (EV_A);
#endif
diff --git a/ev_vars.h b/ev_vars.h
index 808f3c6..3f8f8ca 100644
--- a/ev_vars.h
+++ b/ev_vars.h
@@ -117,6 +117,10 @@ VARx(struct port_event *, port_events)
VARx(int, port_eventmax)
#endif
+#if EV_USE_IOCP || EV_GENWRAP
+VARx(HANDLE, iocp)
+#endif
+
VARx(int *, fdchanges)
VARx(int, fdchangemax)
VARx(int, fdchangecnt)
diff --git a/ev_wrap.h b/ev_wrap.h
index 03b6b87..a67cca3 100644
--- a/ev_wrap.h
+++ b/ev_wrap.h
@@ -47,6 +47,7 @@
#define kqueue_eventmax ((loop)->kqueue_eventmax)
#define port_events ((loop)->port_events)
#define port_eventmax ((loop)->port_eventmax)
+#define iocp ((loop)->iocp)
#define fdchanges ((loop)->fdchanges)
#define fdchangemax ((loop)->fdchangemax)
#define fdchangecnt ((loop)->fdchangecnt)
@@ -135,6 +136,7 @@
#undef kqueue_eventmax
#undef port_events
#undef port_eventmax
+#undef iocp
#undef fdchanges
#undef fdchangemax
#undef fdchangecnt