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

Comparing libev/ev.html (file contents):
Revision 1.64 by root, Fri Dec 7 16:49:49 2007 UTC vs.
Revision 1.65 by root, Fri Dec 7 18:09:40 2007 UTC

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="&lt;standard input&gt;" /> 7 <meta name="inputfile" content="&lt;standard input&gt;" />
8 <meta name="outputfile" content="&lt;standard output&gt;" /> 8 <meta name="outputfile" content="&lt;standard output&gt;" />
9 <meta name="created" content="Fri Dec 7 17:49:47 2007" /> 9 <meta name="created" content="Fri Dec 7 19:03:06 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 -->
917this situation even with a relatively standard program structure. Thus 917this situation even with a relatively standard program structure. Thus
918it is best to always use non-blocking I/O: An extra <code>read</code>(2) returning 918it is best to always use non-blocking I/O: An extra <code>read</code>(2) returning
919<code>EAGAIN</code> is far preferable to a program hanging until some data arrives.</p> 919<code>EAGAIN</code> is far preferable to a program hanging until some data arrives.</p>
920<p>If you cannot run the fd in non-blocking mode (for example you should not 920<p>If you cannot run the fd in non-blocking mode (for example you should not
921play around with an Xlib connection), then you have to seperately re-test 921play around with an Xlib connection), then you have to seperately re-test
922wether a file descriptor is really ready with a known-to-be good interface 922whether a file descriptor is really ready with a known-to-be good interface
923such as poll (fortunately in our Xlib example, Xlib already does this on 923such as poll (fortunately in our Xlib example, Xlib already does this on
924its own, so its quite safe to use).</p> 924its own, so its quite safe to use).</p>
925<dl> 925<dl>
926 <dt>ev_io_init (ev_io *, callback, int fd, int events)</dt> 926 <dt>ev_io_init (ev_io *, callback, int fd, int events)</dt>
927 <dt>ev_io_set (ev_io *, int fd, int events)</dt> 927 <dt>ev_io_set (ev_io *, int fd, int events)</dt>
1832 1832
1833</div> 1833</div>
1834<h1 id="MACRO_MAGIC">MACRO MAGIC</h1> 1834<h1 id="MACRO_MAGIC">MACRO MAGIC</h1>
1835<div id="MACRO_MAGIC_CONTENT"> 1835<div id="MACRO_MAGIC_CONTENT">
1836<p>Libev can be compiled with a variety of options, the most fundemantal is 1836<p>Libev can be compiled with a variety of options, the most fundemantal is
1837<code>EV_MULTIPLICITY</code>. This option determines wether (most) functions and 1837<code>EV_MULTIPLICITY</code>. This option determines whether (most) functions and
1838callbacks have an initial <code>struct ev_loop *</code> argument.</p> 1838callbacks have an initial <code>struct ev_loop *</code> argument.</p>
1839<p>To make it easier to write programs that cope with either variant, the 1839<p>To make it easier to write programs that cope with either variant, the
1840following macros are defined:</p> 1840following macros are defined:</p>
1841<dl> 1841<dl>
1842 <dt><code>EV_A</code>, <code>EV_A_</code></dt> 1842 <dt><code>EV_A</code>, <code>EV_A_</code></dt>
1872 <p>Similar to the other two macros, this gives you the value of the default 1872 <p>Similar to the other two macros, this gives you the value of the default
1873loop, if multiple loops are supported (&quot;ev loop default&quot;).</p> 1873loop, if multiple loops are supported (&quot;ev loop default&quot;).</p>
1874 </dd> 1874 </dd>
1875</dl> 1875</dl>
1876<p>Example: Declare and initialise a check watcher, utilising the above 1876<p>Example: Declare and initialise a check watcher, utilising the above
1877macros so it will work regardless of wether multiple loops are supported 1877macros so it will work regardless of whether multiple loops are supported
1878or not.</p> 1878or not.</p>
1879<pre> static void 1879<pre> static void
1880 check_cb (EV_P_ ev_timer *w, int revents) 1880 check_cb (EV_P_ ev_timer *w, int revents)
1881 { 1881 {
1882 ev_check_stop (EV_A_ w); 1882 ev_check_stop (EV_A_ w);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines