In the collaboration with Ben Noordhuis <info@bnoordhuis.nl> and
Saúl Ibarra Corretgé <saghul@gmail.com>.
Cherry-picked from v1.x (e19089f)
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
When fd is closed and new one (with the same number) is opened inside
kqueue/epoll/port loop's callback - stale events might invoke callbacks
on wrong watchers.
Check if watcher was changed after invocation and invalidate all events
with the same fd.
fix#826