> Sorry for the delay, I now have a prototype patch that you could try if > you > want (feedback would be very appreciated). Unfortunately, it is > completely > untested: > > http://data.plan9.de/winselect.diff
Verified it with the test case I sent earlier as well as with nodejs. In both cases the patch seems to fix this problem. But I think there may be an issue still... > The basic idea is pretty simple: whenever the handle changes, we first > tell > the backend to remove all events (backend_modify (.., 0)) - the > existing code > should then re-arm the backend with the desired watchers. This could be a problem: Windows seems to reuse socket handles sometimes as well. Now suppose that the following happens within the same tick: - close(fd2) // closes underlying handle - close(some_other_fd) - handle = socket() // returns same value as the just closed underlying handle - fd1 = _open_osfhandle(handle); // fd1 < fd2 (likely) - start watcher for fd1 - stop watcher for fd2 This would result in fd_reify first adding the underlying handle because fd1 was added, then removing the same handle because the underlying handle for fd2 used to have the same value. It's hard to write a test case for it. If my reasoning is unclear, I'm happy to try it again. Sometimes I am just plain wrong too. > If that works then this or a similar patch will be part of the next > release. Thanks. - Bert _______________________________________________ libev mailing list [email protected] http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev
