ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.3
(Generate patch)

Comparing libev/ev.3 (file contents):
Revision 1.6 by root, Fri Nov 23 05:14:58 2007 UTC vs.
Revision 1.7 by root, Fri Nov 23 08:36:35 2007 UTC

302While stopping and starting an I/O watcher in the same iteration will 302While stopping and starting an I/O watcher in the same iteration will
303result in some caching, there is still a syscall per such incident 303result in some caching, there is still a syscall per such incident
304(because the fd could point to a different file description now), so its 304(because the fd could point to a different file description now), so its
305best to avoid that. Also, \fIdup()\fRed file descriptors might not work very 305best to avoid that. Also, \fIdup()\fRed file descriptors might not work very
306well if you register events for both fds. 306well if you register events for both fds.
307.Sp
308Please note that epoll sometimes generates spurious notifications, so you
309need to use non-blocking I/O or other means to avoid blocking when no data
310(or space) is available.
307.ie n .IP """EVBACKEND_KQUEUE"" (value 8, most \s-1BSD\s0 clones)" 4 311.ie n .IP """EVBACKEND_KQUEUE"" (value 8, most \s-1BSD\s0 clones)" 4
308.el .IP "\f(CWEVBACKEND_KQUEUE\fR (value 8, most \s-1BSD\s0 clones)" 4 312.el .IP "\f(CWEVBACKEND_KQUEUE\fR (value 8, most \s-1BSD\s0 clones)" 4
309.IX Item "EVBACKEND_KQUEUE (value 8, most BSD clones)" 313.IX Item "EVBACKEND_KQUEUE (value 8, most BSD clones)"
310Kqueue deserves special mention, as at the time of this writing, it 314Kqueue deserves special mention, as at the time of this writing, it
311was broken on all BSDs except NetBSD (usually it doesn't work with 315was broken on all BSDs except NetBSD (usually it doesn't work with
325.ie n .IP """EVBACKEND_PORT"" (value 32, Solaris 10)" 4 329.ie n .IP """EVBACKEND_PORT"" (value 32, Solaris 10)" 4
326.el .IP "\f(CWEVBACKEND_PORT\fR (value 32, Solaris 10)" 4 330.el .IP "\f(CWEVBACKEND_PORT\fR (value 32, Solaris 10)" 4
327.IX Item "EVBACKEND_PORT (value 32, Solaris 10)" 331.IX Item "EVBACKEND_PORT (value 32, Solaris 10)"
328This uses the Solaris 10 port mechanism. As with everything on Solaris, 332This uses the Solaris 10 port mechanism. As with everything on Solaris,
329it's really slow, but it still scales very well (O(active_fds)). 333it's really slow, but it still scales very well (O(active_fds)).
334.Sp
335Please note that solaris ports can result in a lot of spurious
336notifications, so you need to use non-blocking I/O or other means to avoid
337blocking when no data (or space) is available.
330.ie n .IP """EVBACKEND_ALL""" 4 338.ie n .IP """EVBACKEND_ALL""" 4
331.el .IP "\f(CWEVBACKEND_ALL\fR" 4 339.el .IP "\f(CWEVBACKEND_ALL\fR" 4
332.IX Item "EVBACKEND_ALL" 340.IX Item "EVBACKEND_ALL"
333Try all backends (even potentially broken ones that wouldn't be tried 341Try all backends (even potentially broken ones that wouldn't be tried
334with \f(CW\*(C`EVFLAG_AUTO\*(C'\fR). Since this is a mask, you can do stuff such as 342with \f(CW\*(C`EVFLAG_AUTO\*(C'\fR). Since this is a mask, you can do stuff such as
641.IX Item "ev_io_set (ev_io *, int fd, int events)" 649.IX Item "ev_io_set (ev_io *, int fd, int events)"
642.PD 650.PD
643Configures an \f(CW\*(C`ev_io\*(C'\fR watcher. The fd is the file descriptor to rceeive 651Configures an \f(CW\*(C`ev_io\*(C'\fR watcher. The fd is the file descriptor to rceeive
644events for and events is either \f(CW\*(C`EV_READ\*(C'\fR, \f(CW\*(C`EV_WRITE\*(C'\fR or \f(CW\*(C`EV_READ | 652events for and events is either \f(CW\*(C`EV_READ\*(C'\fR, \f(CW\*(C`EV_WRITE\*(C'\fR or \f(CW\*(C`EV_READ |
645EV_WRITE\*(C'\fR to receive the given events. 653EV_WRITE\*(C'\fR to receive the given events.
654.Sp
655Please note that most of the more scalable backend mechanisms (for example
656epoll and solaris ports) can result in spurious readyness notifications
657for file descriptors, so you practically need to use non-blocking I/O (and
658treat callback invocation as hint only), or retest separately with a safe
659interface before doing I/O (XLib can do this), or force the use of either
660\&\f(CW\*(C`EVBACKEND_SELECT\*(C'\fR or \f(CW\*(C`EVBACKEND_POLL\*(C'\fR, which don't suffer from this
661problem. Also note that it is quite easy to have your callback invoked
662when the readyness condition is no longer valid even when employing
663typical ways of handling events, so its a good idea to use non-blocking
664I/O unconditionally.
646.ie n .Sh """ev_timer"" \- relative and optionally recurring timeouts" 665.ie n .Sh """ev_timer"" \- relative and optionally recurring timeouts"
647.el .Sh "\f(CWev_timer\fP \- relative and optionally recurring timeouts" 666.el .Sh "\f(CWev_timer\fP \- relative and optionally recurring timeouts"
648.IX Subsection "ev_timer - relative and optionally recurring timeouts" 667.IX Subsection "ev_timer - relative and optionally recurring timeouts"
649Timer watchers are simple relative timers that generate an event after a 668Timer watchers are simple relative timers that generate an event after a
650given time, and optionally repeating in regular intervals after that. 669given time, and optionally repeating in regular intervals after that.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines