Problem with select on windows [PATCH]
bertbelder at gmail.com
Thu Feb 3 14:05:11 CET 2011
> Sorry for the delay, I now have a prototype patch that you could try if
> want (feedback would be very appreciated). Unfortunately, it is
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
> 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
- handle = socket() // returns same value as the just closed underlying
- 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
More information about the libev