… | |
… | |
4 | <head> |
4 | <head> |
5 | <title>libev</title> |
5 | <title>libev</title> |
6 | <meta name="description" content="Pod documentation for libev" /> |
6 | <meta name="description" content="Pod documentation for libev" /> |
7 | <meta name="inputfile" content="<standard input>" /> |
7 | <meta name="inputfile" content="<standard input>" /> |
8 | <meta name="outputfile" content="<standard output>" /> |
8 | <meta name="outputfile" content="<standard output>" /> |
9 | <meta name="created" content="Sun Nov 18 04:43:20 2007" /> |
9 | <meta name="created" content="Thu Nov 22 13:26:17 2007" /> |
10 | <meta name="generator" content="Pod::Xhtml 1.57" /> |
10 | <meta name="generator" content="Pod::Xhtml 1.57" /> |
11 | <link rel="stylesheet" href="http://res.tst.eu/pod.css"/></head> |
11 | <link rel="stylesheet" href="http://res.tst.eu/pod.css"/></head> |
12 | <body> |
12 | <body> |
13 | <div class="pod"> |
13 | <div class="pod"> |
14 | <!-- INDEX START --> |
14 | <!-- INDEX START --> |
… | |
… | |
186 | <code>LIBEV_FLAGS</code>. Otherwise (the default), this environment variable will |
186 | <code>LIBEV_FLAGS</code>. Otherwise (the default), this environment variable will |
187 | override the flags completely if it is found in the environment. This is |
187 | override the flags completely if it is found in the environment. This is |
188 | useful to try out specific backends to test their performance, or to work |
188 | useful to try out specific backends to test their performance, or to work |
189 | around bugs.</p> |
189 | around bugs.</p> |
190 | </dd> |
190 | </dd> |
191 | <dt><code>EVMETHOD_SELECT</code> (portable select backend)</dt> |
191 | <dt><code>EVMETHOD_SELECT</code> (value 1, portable select backend)</dt> |
|
|
192 | <dd> |
|
|
193 | <p>This is your standard select(2) backend. Not <i>completely</i> standard, as |
|
|
194 | libev tries to roll its own fd_set with no limits on the number of fds, |
|
|
195 | but if that fails, expect a fairly low limit on the number of fds when |
|
|
196 | using this backend. It doesn't scale too well (O(highest_fd)), but its usually |
|
|
197 | the fastest backend for a low number of fds.</p> |
|
|
198 | </dd> |
192 | <dt><code>EVMETHOD_POLL</code> (poll backend, available everywhere except on windows)</dt> |
199 | <dt><code>EVMETHOD_POLL</code> (value 2, poll backend, available everywhere except on windows)</dt> |
193 | <dt><code>EVMETHOD_EPOLL</code> (linux only)</dt> |
200 | <dd> |
194 | <dt><code>EVMETHOD_KQUEUE</code> (some bsds only)</dt> |
201 | <p>And this is your standard poll(2) backend. It's more complicated than |
195 | <dt><code>EVMETHOD_DEVPOLL</code> (solaris 8 only)</dt> |
202 | select, but handles sparse fds better and has no artificial limit on the |
196 | <dt><code>EVMETHOD_PORT</code> (solaris 10 only)</dt> |
203 | number of fds you can use (except it will slow down considerably with a |
|
|
204 | lot of inactive fds). It scales similarly to select, i.e. O(total_fds).</p> |
197 | <dd> |
205 | </dd> |
198 | <p>If one or more of these are ored into the flags value, then only these |
206 | <dt><code>EVMETHOD_EPOLL</code> (value 4, Linux)</dt> |
199 | backends will be tried (in the reverse order as given here). If one are |
207 | <dd> |
200 | specified, any backend will do.</p> |
208 | <p>For few fds, this backend is a bit little slower than poll and select, |
|
|
209 | but it scales phenomenally better. While poll and select usually scale like |
|
|
210 | O(total_fds) where n is the total number of fds (or the highest fd), epoll scales |
|
|
211 | either O(1) or O(active_fds).</p> |
|
|
212 | <p>While stopping and starting an I/O watcher in the same iteration will |
|
|
213 | result in some caching, there is still a syscall per such incident |
|
|
214 | (because the fd could point to a different file description now), so its |
|
|
215 | best to avoid that. Also, dup()ed file descriptors might not work very |
|
|
216 | well if you register events for both fds.</p> |
|
|
217 | </dd> |
|
|
218 | <dt><code>EVMETHOD_KQUEUE</code> (value 8, most BSD clones)</dt> |
|
|
219 | <dd> |
|
|
220 | <p>Kqueue deserves special mention, as at the time of this writing, it |
|
|
221 | was broken on all BSDs except NetBSD (usually it doesn't work with |
|
|
222 | anything but sockets and pipes, except on Darwin, where of course its |
|
|
223 | completely useless). For this reason its not being "autodetected" unless |
|
|
224 | you explicitly specify the flags (i.e. you don't use EVFLAG_AUTO).</p> |
|
|
225 | <p>It scales in the same way as the epoll backend, but the interface to the |
|
|
226 | kernel is more efficient (which says nothing about its actual speed, of |
|
|
227 | course). While starting and stopping an I/O watcher does not cause an |
|
|
228 | extra syscall as with epoll, it still adds up to four event changes per |
|
|
229 | incident, so its best to avoid that.</p> |
|
|
230 | </dd> |
|
|
231 | <dt><code>EVMETHOD_DEVPOLL</code> (value 16, Solaris 8)</dt> |
|
|
232 | <dd> |
|
|
233 | <p>This is not implemented yet (and might never be).</p> |
|
|
234 | </dd> |
|
|
235 | <dt><code>EVMETHOD_PORT</code> (value 32, Solaris 10)</dt> |
|
|
236 | <dd> |
|
|
237 | <p>This uses the Solaris 10 port mechanism. As with everything on Solaris, |
|
|
238 | it's really slow, but it still scales very well (O(active_fds)).</p> |
|
|
239 | </dd> |
|
|
240 | <dt><code>EVMETHOD_ALL</code></dt> |
|
|
241 | <dd> |
|
|
242 | <p>Try all backends (even potentially broken ones). Since this is a mask, you |
|
|
243 | can do stuff like <code>EVMETHOD_ALL & ~EVMETHOD_KQUEUE</code>.</p> |
201 | </dd> |
244 | </dd> |
202 | </dl> |
245 | </dl> |
203 | </p> |
246 | </p> |
|
|
247 | <p>If one or more of these are ored into the flags value, then only these |
|
|
248 | backends will be tried (in the reverse order as given here). If none are |
|
|
249 | specified, most compiled-in backend will be tried, usually in reverse |
|
|
250 | order of their flag values :)</p> |
204 | </dd> |
251 | </dd> |
205 | <dt>struct ev_loop *ev_loop_new (unsigned int flags)</dt> |
252 | <dt>struct ev_loop *ev_loop_new (unsigned int flags)</dt> |
206 | <dd> |
253 | <dd> |
207 | <p>Similar to <code>ev_default_loop</code>, but always creates a new event loop that is |
254 | <p>Similar to <code>ev_default_loop</code>, but always creates a new event loop that is |
208 | always distinct from the default loop. Unlike the default loop, it cannot |
255 | always distinct from the default loop. Unlike the default loop, it cannot |