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

Comparing libev/ev.pod (file contents):
Revision 1.31 by root, Fri Nov 23 05:00:45 2007 UTC vs.
Revision 1.32 by root, Fri Nov 23 08:36:35 2007 UTC

189result in some caching, there is still a syscall per such incident 189result in some caching, there is still a syscall per such incident
190(because the fd could point to a different file description now), so its 190(because the fd could point to a different file description now), so its
191best to avoid that. Also, dup()ed file descriptors might not work very 191best to avoid that. Also, dup()ed file descriptors might not work very
192well if you register events for both fds. 192well if you register events for both fds.
193 193
194Please note that epoll sometimes generates spurious notifications, so you
195need to use non-blocking I/O or other means to avoid blocking when no data
196(or space) is available.
197
194=item C<EVBACKEND_KQUEUE> (value 8, most BSD clones) 198=item C<EVBACKEND_KQUEUE> (value 8, most BSD clones)
195 199
196Kqueue deserves special mention, as at the time of this writing, it 200Kqueue deserves special mention, as at the time of this writing, it
197was broken on all BSDs except NetBSD (usually it doesn't work with 201was broken on all BSDs except NetBSD (usually it doesn't work with
198anything but sockets and pipes, except on Darwin, where of course its 202anything but sockets and pipes, except on Darwin, where of course its
211 215
212=item C<EVBACKEND_PORT> (value 32, Solaris 10) 216=item C<EVBACKEND_PORT> (value 32, Solaris 10)
213 217
214This uses the Solaris 10 port mechanism. As with everything on Solaris, 218This uses the Solaris 10 port mechanism. As with everything on Solaris,
215it's really slow, but it still scales very well (O(active_fds)). 219it's really slow, but it still scales very well (O(active_fds)).
220
221Please note that solaris ports can result in a lot of spurious
222notifications, so you need to use non-blocking I/O or other means to avoid
223blocking when no data (or space) is available.
216 224
217=item C<EVBACKEND_ALL> 225=item C<EVBACKEND_ALL>
218 226
219Try all backends (even potentially broken ones that wouldn't be tried 227Try all backends (even potentially broken ones that wouldn't be tried
220with C<EVFLAG_AUTO>). Since this is a mask, you can do stuff such as 228with C<EVFLAG_AUTO>). Since this is a mask, you can do stuff such as
528 536
529Configures an C<ev_io> watcher. The fd is the file descriptor to rceeive 537Configures an C<ev_io> watcher. The fd is the file descriptor to rceeive
530events for and events is either C<EV_READ>, C<EV_WRITE> or C<EV_READ | 538events for and events is either C<EV_READ>, C<EV_WRITE> or C<EV_READ |
531EV_WRITE> to receive the given events. 539EV_WRITE> to receive the given events.
532 540
541Please note that most of the more scalable backend mechanisms (for example
542epoll and solaris ports) can result in spurious readyness notifications
543for file descriptors, so you practically need to use non-blocking I/O (and
544treat callback invocation as hint only), or retest separately with a safe
545interface before doing I/O (XLib can do this), or force the use of either
546C<EVBACKEND_SELECT> or C<EVBACKEND_POLL>, which don't suffer from this
547problem. Also note that it is quite easy to have your callback invoked
548when the readyness condition is no longer valid even when employing
549typical ways of handling events, so its a good idea to use non-blocking
550I/O unconditionally.
551
533=back 552=back
534 553
535=head2 C<ev_timer> - relative and optionally recurring timeouts 554=head2 C<ev_timer> - relative and optionally recurring timeouts
536 555
537Timer watchers are simple relative timers that generate an event after a 556Timer watchers are simple relative timers that generate an event after a

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines