… | |
… | |
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:03:30 2007" /> |
9 | <meta name="created" content="Mon Nov 12 09:11:00 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 --> |
… | |
… | |
55 | </div> |
55 | </div> |
56 | <h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p> |
56 | <h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p> |
57 | <div id="DESCRIPTION_CONTENT"> |
57 | <div id="DESCRIPTION_CONTENT"> |
58 | <p>Libev is an event loop: you register interest in certain events (such as a |
58 | <p>Libev is an event loop: you register interest in certain events (such as a |
59 | file descriptor being readable or a timeout occuring), and it will manage |
59 | file descriptor being readable or a timeout occuring), and it will manage |
60 | these event sources and provide your program events.</p> |
60 | these event sources and provide your program with events.</p> |
61 | <p>To do this, it must take more or less complete control over your process |
61 | <p>To do this, it must take more or less complete control over your process |
62 | (or thread) by executing the <i>event loop</i> handler, and will then |
62 | (or thread) by executing the <i>event loop</i> handler, and will then |
63 | communicate events via a callback mechanism.</p> |
63 | communicate events via a callback mechanism.</p> |
64 | <p>You register interest in certain events by registering so-called <i>event |
64 | <p>You register interest in certain events by registering so-called <i>event |
65 | watchers</i>, which are relatively small C structures you initialise with the |
65 | watchers</i>, which are relatively small C structures you initialise with the |
… | |
… | |
316 | *)</code>), and you can stop watching for events at any time by calling the |
316 | *)</code>), and you can stop watching for events at any time by calling the |
317 | corresponding stop function (<code>ev_<type>_stop (loop, watcher *)</code>.</p> |
317 | corresponding stop function (<code>ev_<type>_stop (loop, watcher *)</code>.</p> |
318 | <p>As long as your watcher is active (has been started but not stopped) you |
318 | <p>As long as your watcher is active (has been started but not stopped) you |
319 | must not touch the values stored in it. Most specifically you must never |
319 | must not touch the values stored in it. Most specifically you must never |
320 | reinitialise it or call its set method.</p> |
320 | reinitialise it or call its set method.</p> |
321 | <p>You cna check wether an event is active by calling the <code>ev_is_active |
321 | <p>You cna check whether an event is active by calling the <code>ev_is_active |
322 | (watcher *)</code> macro. To see wether an event is outstanding (but the |
322 | (watcher *)</code> macro. To see whether an event is outstanding (but the |
323 | callback for it has not been called yet) you cna use the <code>ev_is_pending |
323 | callback for it has not been called yet) you cna use the <code>ev_is_pending |
324 | (watcher *)</code> macro.</p> |
324 | (watcher *)</code> macro.</p> |
325 | <p>Each and every callback receives the event loop pointer as first, the |
325 | <p>Each and every callback receives the event loop pointer as first, the |
326 | registered watcher structure as second, and a bitset of received events as |
326 | registered watcher structure as second, and a bitset of received events as |
327 | third argument.</p> |
327 | third argument.</p> |
… | |
… | |
422 | information given in the last section.</p> |
422 | information given in the last section.</p> |
423 | |
423 | |
424 | </div> |
424 | </div> |
425 | <h2 id="struct_ev_io_is_my_file_descriptor_r">struct ev_io - is my file descriptor readable or writable</h2> |
425 | <h2 id="struct_ev_io_is_my_file_descriptor_r">struct ev_io - is my file descriptor readable or writable</h2> |
426 | <div id="struct_ev_io_is_my_file_descriptor_r-2"> |
426 | <div id="struct_ev_io_is_my_file_descriptor_r-2"> |
427 | <p>I/O watchers check wether a file descriptor is readable or writable |
427 | <p>I/O watchers check whether a file descriptor is readable or writable |
428 | in each iteration of the event loop (This behaviour is called |
428 | in each iteration of the event loop (This behaviour is called |
429 | level-triggering because you keep receiving events as long as the |
429 | level-triggering because you keep receiving events as long as the |
430 | condition persists. Remember you cna stop the watcher if you don't want to |
430 | condition persists. Remember you cna stop the watcher if you don't want to |
431 | act on the event and neither want to receive future events).</p> |
431 | act on the event and neither want to receive future events).</p> |
432 | <dl> |
432 | <dl> |