… | |
… | |
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="Mon Nov 12 09:16:01 2007" /> |
9 | <meta name="created" content="Mon Nov 12 09:20:02 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 --> |
… | |
… | |
157 | false. If it already was initialised it simply returns it (and ignores the |
157 | false. If it already was initialised it simply returns it (and ignores the |
158 | flags).</p> |
158 | flags).</p> |
159 | <p>If you don't know what event loop to use, use the one returned from this |
159 | <p>If you don't know what event loop to use, use the one returned from this |
160 | function.</p> |
160 | function.</p> |
161 | <p>The flags argument can be used to specify special behaviour or specific |
161 | <p>The flags argument can be used to specify special behaviour or specific |
162 | backends to use, and is usually specified as 0 (or EVFLAG_AUTO)</p> |
162 | backends to use, and is usually specified as 0 (or EVFLAG_AUTO).</p> |
163 | <p>It supports the following flags:</p> |
163 | <p>It supports the following flags:</p> |
164 | <p> |
164 | <p> |
165 | <dl> |
165 | <dl> |
166 | <dt>EVFLAG_AUTO</dt> |
166 | <dt>EVFLAG_AUTO</dt> |
167 | <dd> |
167 | <dd> |
168 | <p>The default flags value. Use this if you have no clue (its the right |
168 | <p>The default flags value. Use this if you have no clue (its the right |
169 | thing, believe me).</p> |
169 | thing, believe me).</p> |
170 | </dd> |
170 | </dd> |
171 | <dt>EVFLAG_NOENV</dt> |
171 | <dt>EVFLAG_NOENV</dt> |
172 | <dd> |
172 | <dd> |
173 | <p>If this flag bit is ored into the flag value then libev will <i>not</i> look |
173 | <p>If this flag bit is ored into the flag value (or the program runs setuid |
174 | at the environment variable <code>LIBEV_FLAGS</code>. Otherwise (the default), this |
174 | or setgid) then libev will <i>not</i> look at the environment variable |
175 | environment variable will override the flags completely. This is useful |
175 | <code>LIBEV_FLAGS</code>. Otherwise (the default), this environment variable will |
|
|
176 | override the flags completely if it is found in the environment. This is |
176 | to try out specific backends to tets their performance, or to work around |
177 | useful to try out specific backends to test their performance, or to work |
177 | bugs.</p> |
178 | around bugs.</p> |
178 | </dd> |
179 | </dd> |
179 | <dt>EVMETHOD_SELECT portable select backend</dt> |
180 | <dt>EVMETHOD_SELECT portable select backend</dt> |
180 | <dt>EVMETHOD_POLL poll backend (everywhere except windows)</dt> |
181 | <dt>EVMETHOD_POLL poll backend (everywhere except windows)</dt> |
181 | <dt>EVMETHOD_EPOLL linux only</dt> |
182 | <dt>EVMETHOD_EPOLL linux only</dt> |
182 | <dt>EVMETHOD_KQUEUE some bsds only</dt> |
183 | <dt>EVMETHOD_KQUEUE some bsds only</dt> |
… | |
… | |
430 | <p>I/O watchers check whether a file descriptor is readable or writable |
431 | <p>I/O watchers check whether a file descriptor is readable or writable |
431 | in each iteration of the event loop (This behaviour is called |
432 | in each iteration of the event loop (This behaviour is called |
432 | level-triggering because you keep receiving events as long as the |
433 | level-triggering because you keep receiving events as long as the |
433 | condition persists. Remember you cna stop the watcher if you don't want to |
434 | condition persists. Remember you cna stop the watcher if you don't want to |
434 | act on the event and neither want to receive future events).</p> |
435 | act on the event and neither want to receive future events).</p> |
|
|
436 | <p>In general you can register as many read and/or write event watchers oer |
|
|
437 | fd as you want (as long as you don't confuse yourself). Setting all file |
|
|
438 | descriptors to non-blocking mode is also usually a good idea (but not |
|
|
439 | required if you know what you are doing).</p> |
|
|
440 | <p>You have to be careful with dup'ed file descriptors, though. Some backends |
|
|
441 | (the linux epoll backend is a notable example) cannot handle dup'ed file |
|
|
442 | descriptors correctly if you register interest in two or more fds pointing |
|
|
443 | to the same file/socket etc. description.</p> |
|
|
444 | <p>If you must do this, then force the use of a known-to-be-good backend |
|
|
445 | (at the time of this writing, this includes only EVMETHOD_SELECT and |
|
|
446 | EVMETHOD_POLL).</p> |
435 | <dl> |
447 | <dl> |
436 | <dt>ev_io_init (ev_io *, callback, int fd, int events)</dt> |
448 | <dt>ev_io_init (ev_io *, callback, int fd, int events)</dt> |
437 | <dt>ev_io_set (ev_io *, int fd, int events)</dt> |
449 | <dt>ev_io_set (ev_io *, int fd, int events)</dt> |
438 | <dd> |
450 | <dd> |
439 | <p>Configures an ev_io watcher. The fd is the file descriptor to rceeive |
451 | <p>Configures an ev_io watcher. The fd is the file descriptor to rceeive |