dwrensha / gj

event loop and promises in Rust
MIT License
110 stars 13 forks source link

Never deregister? #3

Closed lcy03406 closed 8 years ago

lcy03406 commented 8 years ago

Donno if it's the place to discuss such things. Sorry in advance.

Maybe I'm wrong, but I find that the events never deregister from mio. Is that ok?

dwrensha commented 8 years ago

Thanks for asking! epoll() automatically removes descriptors that have been closed, and I think that kevent() acts roughly the same. However, I had not realized until just now that there could be a problem if a file descriptor is dup()ed, as can happen through the try_clone() call. ( see Q6 in http://man7.org/linux/man-pages/man7/epoll.7.html ) I may need to deregister, after all!

dwrensha commented 8 years ago

Fixed in https://github.com/dwrensha/gj/commit/80b5d2718468504de8d4f755d6633c9170c55e8d.