Problem with select on windows

Bert Belder bertbelder at gmail.com
Mon Jan 24 22:04:42 CET 2011


There is a problem with libev/select on windows. When a socket that is being
observed with an ev_io watcher is closed, and the same fd gets re-used for
another socket in the same tick (so before control to is returned to libev),
the windows handle that is cached in ANFD->handle is not updated. And even
if it were updated, select_modify will not correctly remove the old handle
from the select() fdset, because the handle stored in ANFD->handle would be
overwritten. 

I have no non-intrusive solution for it; the attached patch allows to work
around this problem by calling ev_fd_closed() immediately after closing the
socket. It makes libev remove the socket handle from the fdset and update
the handle associated with the FD.

Is there a better solution to this problem?
And if not, any chance that this patch could be landed?

- Bert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Workaround-for-libev-handle-caching-bug-on-windows.patch
Type: application/octet-stream
Size: 2229 bytes
Desc: not available
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20110124/3644083c/attachment.obj>


More information about the libev mailing list