summaryrefslogtreecommitdiff
path: root/ev.c
diff options
context:
space:
mode:
authorroot <root>2009-08-19 23:44:51 +0000
committerroot <root>2009-08-19 23:44:51 +0000
commit7e01fd517f7b34988d3438bdde655b75c389de2d (patch)
treea3d40ab1d554899ad553eb38c35d59d0866b01cc /ev.c
parent72dedbe4624c9dfb3b928a1c3e2d4d5c23bb144c (diff)
*** empty log message ***
Diffstat (limited to 'ev.c')
-rw-r--r--ev.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/ev.c b/ev.c
index 4e19864..1161aa3 100644
--- a/ev.c
+++ b/ev.c
@@ -478,6 +478,16 @@ static EV_ATOMIC_T have_realtime; /* did clock_gettime (CLOCK_REALTIME) work? */
static EV_ATOMIC_T have_monotonic; /* did clock_gettime (CLOCK_MONOTONIC) work? */
#endif
+#ifndef EV_FD_TO_WIN32_HANDLE
+# define EV_FD_TO_WIN32_HANDLE(fd) _get_osfhandle (fd)
+#endif
+#ifndef EV_WIN32_HANDLE_TO_FD
+# define EV_WIN32_HANDLE_TO_FD(handle) _open_osfhandle (fd, 0)
+#endif
+#ifndef EV_WIN32_CLOSE_FD
+# define EV_WIN32_CLOSE_FD(fd) close (fd)
+#endif
+
#ifdef _WIN32
# include "ev_win32.c"
#endif
@@ -878,11 +888,7 @@ fd_reify (EV_P)
if (events)
{
unsigned long arg;
- #ifdef EV_FD_TO_WIN32_HANDLE
- anfd->handle = EV_FD_TO_WIN32_HANDLE (fd);
- #else
- anfd->handle = _get_osfhandle (fd);
- #endif
+ anfd->handle = EV_FD_TO_WIN32_HANDLE (fd);
assert (("libev: only socket fds supported in this configuration", ioctlsocket (anfd->handle, FIONREAD, &arg) == 0));
}
#endif
@@ -1623,8 +1629,8 @@ loop_destroy (EV_P)
if (evpipe [0] >= 0)
{
- close (evpipe [0]);
- close (evpipe [1]);
+ EV_WIN32_CLOSE_FD (evpipe [0]);
+ EV_WIN32_CLOSE_FD (evpipe [1]);
}
}
@@ -1730,8 +1736,8 @@ loop_fork (EV_P)
if (evpipe [0] >= 0)
{
- close (evpipe [0]);
- close (evpipe [1]);
+ EV_WIN32_CLOSE_FD (evpipe [0]);
+ EV_WIN32_CLOSE_FD (evpipe [1]);
}
evpipe_init (EV_A);