From 7e01fd517f7b34988d3438bdde655b75c389de2d Mon Sep 17 00:00:00 2001 From: root Date: Wed, 19 Aug 2009 23:44:51 +0000 Subject: *** empty log message *** --- ev.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'ev.c') 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); -- cgit v1.2.3