diff options
author | root <root> | 2008-10-27 11:08:29 +0000 |
---|---|---|
committer | root <root> | 2008-10-27 11:08:29 +0000 |
commit | ed3f7d82632357b7ba925cb742cd9ef61ceed26d (patch) | |
tree | 1c03ccb4ac30a7c147b4b5be39f99b5fe1325e14 /ev.pod | |
parent | 591339236dd05d5184c977fea78de5f5d82e70e1 (diff) |
work around epoll spurious notifications
Diffstat (limited to 'ev.pod')
-rw-r--r-- | ev.pod | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -391,16 +391,19 @@ of shortcomings, such as silently dropping events in some hard-to-detect cases and requiring a system call per fd change, no fork support and bad support for dup. +Epoll is also notoriously buggy - embedding epoll fds should work, but +of course doesn't, and epoll just loves to report events for totally +I<different> file descriptors (even already closed ones) than registered +in the set (especially on SMP systems). Libev tries to counter these +spurious notifications by employing an additional generation counter and +comparing that against the events to filter out spurious ones. + While stopping, setting and starting an I/O watcher in the same iteration will result in some caching, there is still a system call per such incident (because the fd could point to a different file description now), so its best to avoid that. Also, C<dup ()>'ed file descriptors might not work very well if you register events for both fds. -Please note that epoll sometimes generates spurious notifications, so you -need to use non-blocking I/O or other means to avoid blocking when no data -(or space) is available. - Best performance from this backend is achieved by not unregistering all watchers for a file descriptor until it has been closed, if possible, i.e. keep at least one watcher active per fd at all times. Stopping and |