Problem with select on windows

Bert Belder bertbelder at
Fri Feb 11 02:03:23 CET 2011

> Just keep them coming - it's nice to see somebody actively test the
> pure
> win32 backend, which is something I rarely do.

Well, there we go again :-) For a while I thought that everything was okay,
but then I ran into this:

Suppose something like this happens in the same tick (I know this will not
compile, heh).
   fd = _open_osfhandle(socket());
   ev_io_set(w, fd, EV_READ);

This makes the following assertion fail:
   assert (("libev: only socket fds supported in this configuration",
ioctlsocket (handle, FIONREAD, &arg) == 0));

I *think* the cause is this: ev_io_set/start adds the fd to the fdchange
list, close(fd) invalidates the fd, and ev_io_stop adds it another time. By
the time control returns to libev, the invalid fd is still on the change
list, so libev attempts to EV__IOFDSET it (can we consider that a verb?),
then bumps into the assert mentioned above.


- Bert

More information about the libev mailing list