]> rtime.felk.cvut.cz Git - sojka/libev.git/commitdiff
*** empty log message ***
authorMarc Alexander Lehmann <libev@schmorp.de>
Sun, 6 May 2012 19:29:59 +0000 (19:29 +0000)
committerMarc Alexander Lehmann <libev@schmorp.de>
Sun, 6 May 2012 19:29:59 +0000 (19:29 +0000)
Changes
ev.c
ev.pod

diff --git a/Changes b/Changes
index 9f3bf5da1175fc75bba622fc3e69007cfe920f3f..0852663780415ffca60f3b5be7516895d290571a 100644 (file)
--- a/Changes
+++ b/Changes
@@ -29,6 +29,7 @@ TODO: faq, process a thing in each iteration
         - include sys/syscall.h instead of plain syscall.h.
         - check for io watcher loops in ev_verify, check for the most
           common reported usage bug in ev_io_start.
+        - chose socket vs. WSASocket at compiletime using EV_USE_WSASOCKET.
 
 4.11 Sat Feb  4 19:52:39 CET 2012
        - INCOMPATIBLE CHANGE: ev_timer_again now clears the pending status, as
diff --git a/ev.c b/ev.c
index c2720a74dc96a3034d30179bab4e2e2dc8f2fb3b..fe7cfa79dcd5b4724a1699743f8d00b4400b360a 100644 (file)
--- 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
         }
     }
 
diff --git a/ev.pod b/ev.pod
index 784a2fa66d794519c41b3800100af22976fb1f75..70c5f0a956ea888e6fcf74e188efba29f1de92e8 100644 (file)
--- a/ev.pod
+++ b/ev.pod
@@ -4556,6 +4556,13 @@ macro can be used to override the C<close> function, useful to unregister
 file descriptors again. Note that the replacement function has to close
 the underlying OS handle.
 
+=item EV_USE_WSASOCKET
+
+If defined to be C<1>, libev will use C<WSASocket> to create its internal
+communication socket, which works better in some environments. Otherwise,
+the normal C<socket> function will be used, which works better in other
+enviornments.
+
 =item EV_USE_POLL
 
 If defined to be C<1>, libev will compile in support for the C<poll>(2)