Async Watcher Issue on Windows

Marc Lehmann schmorp at
Tue Feb 21 05:41:15 CET 2012

On Mon, Feb 20, 2012 at 03:52:55PM +0000, Anton Kirilov <akirilov at> wrote:
> > What was the exact symptom you saw without the patch? ev_async silently being ignored?
> The write() call inside evpipe_write() returned -1; the return value is not checked anywhere, hence the "silent" part.

thanks - that is meant for the main documenttaion in the win32 section.

> Actually, I wouldn't be surprised if the problem the comments right
> before the invocation of write() refer to is the same, so perhaps you
> should add a remark that people ought to try EV_USE_WSASOCKET before
> replacing write() with send().

hmm, there is an idea though - my reading of WSASend suggests that it
works on sockets regardless of whether they are overlapped, so maybe
adding some win32 hackery using EV_FD_TO_WIN32_HANDLE and WSASend might do the
trick without a compiletime symbol.

Can you test that using socket and this instead of the send in
evpipe_write works maybe?

   WSABUF buf;
   DWORD sent;
   buf.buf = &buf;
   buf.len = 1;
   WSASend (EV_FD_TO_WIN32_HANDLE (evpipe [1]), &buf, 1, &sent, 0, 0, 0);

Or maybe similar code (I haven't tested the above).

If that works in your case, it would get rid of EV_USE_WSASOCKET entirely.

We might still need similar code for WSARecv instead of read in the
receive path though.

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_    
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list