From 2de9ecb7221f0bfe6db88a6b30104bea82c6ceac Mon Sep 17 00:00:00 2001 From: root Date: Sun, 6 May 2012 19:29:59 +0000 Subject: *** empty log message *** --- ev.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'ev.c') diff --git a/ev.c b/ev.c index c2720a7..fe7cfa7 100644 --- a/ev.c +++ b/ev.c @@ -1878,14 +1878,15 @@ evpipe_write (EV_P_ EV_ATOMIC_T *flag) else #endif { - /* win32 people keep sending patches that change this write() to send() */ - /* and then run away. but send() is wrong, it wants a socket handle on win32 */ - /* so when you think this write should be a send instead, please find out */ - /* where your send() is from - it's definitely not the microsoft send, and */ - /* tell me. thank you. */ - /* it might be that your problem is that your environment needs EV_USE_WSASOCKET */ - /* check the ev documentation on how to use this flag */ +#ifdef _WIN32 + WSABUF buf; + DWORD sent; + buf.buf = &buf; + buf.len = 1; + WSASend (EV_FD_TO_WIN32_HANDLE (evpipe [1]), &buf, 1, &sent, 0, 0, 0); +#else write (evpipe [1], &(evpipe [1]), 1); +#endif } errno = old_errno; @@ -1910,9 +1911,16 @@ pipecb (EV_P_ ev_io *iow, int revents) else #endif { - char dummy; - /* see discussion in evpipe_write when you think this read should be recv in win32 */ - read (evpipe [0], &dummy, 1); + char dummy[4]; +#ifdef _WIN32 + WSABUF buf; + DWORD recvd; + buf.buf = dummy; + buf.len = sizeof (dummy); + WSARecv (EV_FD_TO_WIN32_HANDLE (evpipe [0]), &buf, 1, &recvd, 0, 0, 0); +#else + read (evpipe [0], &dummy, sizeof (dummy)); +#endif } } -- cgit v1.2.3