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

Comparing libev/ev.3 (file contents):
Revision 1.2 by root, Sun Nov 18 03:43:24 2007 UTC vs.
Revision 1.3 by root, Thu Nov 22 12:28:27 2007 UTC

127.\} 127.\}
128.rm #[ #] #H #V #F C 128.rm #[ #] #H #V #F C
129.\" ======================================================================== 129.\" ========================================================================
130.\" 130.\"
131.IX Title ""<STANDARD INPUT>" 1" 131.IX Title ""<STANDARD INPUT>" 1"
132.TH "<STANDARD INPUT>" 1 "2007-11-18" "perl v5.8.8" "User Contributed Perl Documentation" 132.TH "<STANDARD INPUT>" 1 "2007-11-22" "perl v5.8.8" "User Contributed Perl Documentation"
133.SH "NAME" 133.SH "NAME"
134libev \- a high performance full\-featured event loop written in C 134libev \- a high performance full\-featured event loop written in C
135.SH "SYNOPSIS" 135.SH "SYNOPSIS"
136.IX Header "SYNOPSIS" 136.IX Header "SYNOPSIS"
137.Vb 1 137.Vb 1
260or setgid) then libev will \fInot\fR look at the environment variable 260or setgid) then libev will \fInot\fR look at the environment variable
261\&\f(CW\*(C`LIBEV_FLAGS\*(C'\fR. Otherwise (the default), this environment variable will 261\&\f(CW\*(C`LIBEV_FLAGS\*(C'\fR. Otherwise (the default), this environment variable will
262override the flags completely if it is found in the environment. This is 262override the flags completely if it is found in the environment. This is
263useful to try out specific backends to test their performance, or to work 263useful to try out specific backends to test their performance, or to work
264around bugs. 264around bugs.
265.ie n .IP """EVMETHOD_SELECT"" (portable select backend)" 4 265.ie n .IP """EVMETHOD_SELECT"" (value 1, portable select backend)" 4
266.el .IP "\f(CWEVMETHOD_SELECT\fR (portable select backend)" 4 266.el .IP "\f(CWEVMETHOD_SELECT\fR (value 1, portable select backend)" 4
267.IX Item "EVMETHOD_SELECT (portable select backend)" 267.IX Item "EVMETHOD_SELECT (value 1, portable select backend)"
268.PD 0 268This is your standard \fIselect\fR\|(2) backend. Not \fIcompletely\fR standard, as
269libev tries to roll its own fd_set with no limits on the number of fds,
270but if that fails, expect a fairly low limit on the number of fds when
271using this backend. It doesn't scale too well (O(highest_fd)), but its usually
272the fastest backend for a low number of fds.
269.ie n .IP """EVMETHOD_POLL"" (poll backend, available everywhere except on windows)" 4 273.ie n .IP """EVMETHOD_POLL"" (value 2, poll backend, available everywhere except on windows)" 4
270.el .IP "\f(CWEVMETHOD_POLL\fR (poll backend, available everywhere except on windows)" 4 274.el .IP "\f(CWEVMETHOD_POLL\fR (value 2, poll backend, available everywhere except on windows)" 4
271.IX Item "EVMETHOD_POLL (poll backend, available everywhere except on windows)" 275.IX Item "EVMETHOD_POLL (value 2, poll backend, available everywhere except on windows)"
276And this is your standard \fIpoll\fR\|(2) backend. It's more complicated than
277select, but handles sparse fds better and has no artificial limit on the
278number of fds you can use (except it will slow down considerably with a
279lot of inactive fds). It scales similarly to select, i.e. O(total_fds).
272.ie n .IP """EVMETHOD_EPOLL"" (linux only)" 4 280.ie n .IP """EVMETHOD_EPOLL"" (value 4, Linux)" 4
273.el .IP "\f(CWEVMETHOD_EPOLL\fR (linux only)" 4 281.el .IP "\f(CWEVMETHOD_EPOLL\fR (value 4, Linux)" 4
274.IX Item "EVMETHOD_EPOLL (linux only)" 282.IX Item "EVMETHOD_EPOLL (value 4, Linux)"
275.ie n .IP """EVMETHOD_KQUEUE"" (some bsds only)" 4 283For few fds, this backend is a bit little slower than poll and select,
276.el .IP "\f(CWEVMETHOD_KQUEUE\fR (some bsds only)" 4 284but it scales phenomenally better. While poll and select usually scale like
277.IX Item "EVMETHOD_KQUEUE (some bsds only)" 285O(total_fds) where n is the total number of fds (or the highest fd), epoll scales
286either O(1) or O(active_fds).
287.Sp
288While stopping and starting an I/O watcher in the same iteration will
289result in some caching, there is still a syscall per such incident
290(because the fd could point to a different file description now), so its
291best to avoid that. Also, \fIdup()\fRed file descriptors might not work very
292well if you register events for both fds.
293.ie n .IP """EVMETHOD_KQUEUE"" (value 8, most \s-1BSD\s0 clones)" 4
294.el .IP "\f(CWEVMETHOD_KQUEUE\fR (value 8, most \s-1BSD\s0 clones)" 4
295.IX Item "EVMETHOD_KQUEUE (value 8, most BSD clones)"
296Kqueue deserves special mention, as at the time of this writing, it
297was broken on all BSDs except NetBSD (usually it doesn't work with
298anything but sockets and pipes, except on Darwin, where of course its
299completely useless). For this reason its not being \*(L"autodetected\*(R" unless
300you explicitly specify the flags (i.e. you don't use \s-1EVFLAG_AUTO\s0).
301.Sp
302It scales in the same way as the epoll backend, but the interface to the
303kernel is more efficient (which says nothing about its actual speed, of
304course). While starting and stopping an I/O watcher does not cause an
305extra syscall as with epoll, it still adds up to four event changes per
306incident, so its best to avoid that.
278.ie n .IP """EVMETHOD_DEVPOLL"" (solaris 8 only)" 4 307.ie n .IP """EVMETHOD_DEVPOLL"" (value 16, Solaris 8)" 4
279.el .IP "\f(CWEVMETHOD_DEVPOLL\fR (solaris 8 only)" 4 308.el .IP "\f(CWEVMETHOD_DEVPOLL\fR (value 16, Solaris 8)" 4
280.IX Item "EVMETHOD_DEVPOLL (solaris 8 only)" 309.IX Item "EVMETHOD_DEVPOLL (value 16, Solaris 8)"
310This is not implemented yet (and might never be).
281.ie n .IP """EVMETHOD_PORT"" (solaris 10 only)" 4 311.ie n .IP """EVMETHOD_PORT"" (value 32, Solaris 10)" 4
282.el .IP "\f(CWEVMETHOD_PORT\fR (solaris 10 only)" 4 312.el .IP "\f(CWEVMETHOD_PORT\fR (value 32, Solaris 10)" 4
283.IX Item "EVMETHOD_PORT (solaris 10 only)" 313.IX Item "EVMETHOD_PORT (value 32, Solaris 10)"
284.PD 314This uses the Solaris 10 port mechanism. As with everything on Solaris,
285If one or more of these are ored into the flags value, then only these 315it's really slow, but it still scales very well (O(active_fds)).
286backends will be tried (in the reverse order as given here). If one are 316.ie n .IP """EVMETHOD_ALL""" 4
287specified, any backend will do. 317.el .IP "\f(CWEVMETHOD_ALL\fR" 4
318.IX Item "EVMETHOD_ALL"
319Try all backends (even potentially broken ones). Since this is a mask, you
320can do stuff like \f(CW\*(C`EVMETHOD_ALL & ~EVMETHOD_KQUEUE\*(C'\fR.
288.RE 321.RE
289.RS 4 322.RS 4
323.Sp
324If one or more of these are ored into the flags value, then only these
325backends will be tried (in the reverse order as given here). If none are
326specified, most compiled-in backend will be tried, usually in reverse
327order of their flag values :)
290.RE 328.RE
291.IP "struct ev_loop *ev_loop_new (unsigned int flags)" 4 329.IP "struct ev_loop *ev_loop_new (unsigned int flags)" 4
292.IX Item "struct ev_loop *ev_loop_new (unsigned int flags)" 330.IX Item "struct ev_loop *ev_loop_new (unsigned int flags)"
293Similar to \f(CW\*(C`ev_default_loop\*(C'\fR, but always creates a new event loop that is 331Similar to \f(CW\*(C`ev_default_loop\*(C'\fR, but always creates a new event loop that is
294always distinct from the default loop. Unlike the default loop, it cannot 332always distinct from the default loop. Unlike the default loop, it cannot

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines