X-Git-Url: https://git.llucax.com/software/libev.git/blobdiff_plain/86521c1ef67d371e724e4419f5100dc0da641194..fb945aab28d6c071e9305ba76f6637a2f0dea798:/ev.pod diff --git a/ev.pod b/ev.pod index 26d837b..714fc5b 100644 --- a/ev.pod +++ b/ev.pod @@ -341,20 +341,23 @@ need to use non-blocking I/O or other means to avoid blocking when no data =item C (value 8, most BSD clones) Kqueue deserves special mention, as at the time of this writing, it -was broken on I BSDs (usually it doesn't work with anything but -sockets and pipes, except on Darwin, where of course it's completely -useless. On NetBSD, it seems to work for all the FD types I tested, so it -is used by default there). For this reason it's not being "autodetected" +was broken on all BSDs except NetBSD (usually it doesn't work reliably +with anything but sockets and pipes, except on Darwin, where of course +it's completely useless). For this reason it's not being "autodetected" unless you explicitly specify it explicitly in the flags (i.e. using C) or libev was compiled on a known-to-be-good (-enough) system like NetBSD. +You still can embed kqueue into a normal poll or select backend and use it +only for sockets (after having made sure that sockets work with kqueue on +the target platform). See C watchers for more info. + It scales in the same way as the epoll backend, but the interface to the -kernel is more efficient (which says nothing about its actual speed, -of course). While stopping, setting and starting an I/O watcher does -never cause an extra syscall as with epoll, it still adds up to two event -changes per incident, support for C is very bad and it drops fds -silently in similarly hard-to-detetc cases. +kernel is more efficient (which says nothing about its actual speed, of +course). While stopping, setting and starting an I/O watcher does never +cause an extra syscall as with C, it still adds up to +two event changes per incident, support for C is very bad and it +drops fds silently in similarly hard-to-detect cases. =item C (value 16, Solaris 8) @@ -598,12 +601,14 @@ overhead for the actual polling but can deliver many events at once. By setting a higher I you allow libev to spend more time collecting I/O events, so you can handle more events per iteration, at the cost of increasing latency. Timeouts (both C and -C) will be not affected. +C) will be not affected. Setting this to a non-null value will +introduce an additional C call into most loop iterations. Likewise, by setting a higher I you allow libev to spend more time collecting timeouts, at the expense of increased latency (the watcher callback will be called later). C watchers -will not be affected. +will not be affected. Setting this to a non-null value will not introduce +any overhead in libev. Many (busy) programs can usually benefit by setting the io collect interval to a value near C<0.1> or so, which is often enough for @@ -1623,11 +1628,11 @@ It is recommended to give C watchers highest (C) priority, to ensure that they are being run before any other watchers after the poll. Also, C watchers (and C watchers, too) should not activate ("feed") events into libev. While libev fully -supports this, they will be called before other C watchers did -their job. As C watchers are often used to embed other event -loops those other event loops might be in an unusable state until their -C watcher ran (always remind yourself to coexist peacefully with -others). +supports this, they will be called before other C watchers +did their job. As C watchers are often used to embed other +(non-libev) event loops those other event loops might be in an unusable +state until their C watcher ran (always remind yourself to +coexist peacefully with others). =head3 Watcher-Specific Functions and Data Members @@ -1776,7 +1781,7 @@ this. This is a rather advanced watcher type that lets you embed one event loop into another (currently only C events are supported in the embedded loop, other types of watchers might be handled in a delayed or incorrect -fashion and must not be used). (See portability notes, below). +fashion and must not be used). There are primarily two reasons you would want that: work around bugs and prioritise I/O. @@ -1841,22 +1846,6 @@ create it, and if that fails, use the normal loop for everything: else loop_lo = loop_hi; -=head2 Portability notes - -Kqueue is nominally embeddable, but this is broken on all BSDs that I -tried, in various ways. Usually the embedded event loop will simply never -receive events, sometimes it will only trigger a few times, sometimes in a -loop. Epoll is also nominally embeddable, but many Linux kernel versions -will always eport the epoll fd as ready, even when no events are pending. - -While libev allows embedding these backends (they are contained in -C), take extreme care that it will actually -work. - -When in doubt, create a dynamic event loop forced to use sockets (this -usually works) and possibly another thread and a pipe or so to report to -your main event loop. - =head3 Watcher-Specific Functions and Data Members =over 4