I'm pretty well convinced now that there's no reason we should be
maintaining a weak map from fileno numbers (our pseudo-file
descriptors) to ChannelDescriptor objects (or file-descriptor-like
wrapper around a NIO Channel). Here's why:
* If you open a file in C and never close it, it will never
If there is no compatibility problem with doing this then so much the
better. I thought it had something to do with reattaching to the same
IO resource when you opened IO in weird ways like using fileno to IO
constructor? something like (not tested just remembered):
a = File.new(foo)
b =
That case basically just re-wraps that fd with a new IO object. In MRI
it *can* be prematurely closed if you have multiple IOs pointing at
the same fd, and in JRuby it's no different (though in our case, it's
because unlike reopen, IO.new doesn't dup the descriptor, and so we
don't increment our