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

Comparing libev/ev.html (file contents):
Revision 1.52 by root, Tue Nov 27 19:41:52 2007 UTC vs.
Revision 1.53 by root, Tue Nov 27 20:15:02 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="Tue Nov 27 20:38:24 2007" /> 9 <meta name="created" content="Tue Nov 27 21:14:27 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 -->
66<p>libev - a high performance full-featured event loop written in C</p> 66<p>libev - a high performance full-featured event loop written in C</p>
67 67
68</div> 68</div>
69<h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p> 69<h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
70<div id="SYNOPSIS_CONTENT"> 70<div id="SYNOPSIS_CONTENT">
71<pre> /* this is the only header you need */
71<pre> #include &lt;ev.h&gt; 72 #include &lt;ev.h&gt;
73
74 /* what follows is a fully working example program */
75 ev_io stdin_watcher;
76 ev_timer timeout_watcher;
77
78 /* called when data readable on stdin */
79 static void
80 stdin_cb (EV_P_ struct ev_io *w, int revents)
81 {
82 /* puts (&quot;stdin ready&quot;); */
83 ev_io_stop (EV_A_ w); /* just a syntax example */
84 ev_unloop (EV_A_ EVUNLOOP_ALL); /* leave all loop calls */
85 }
86
87 static void
88 timeout_cb (EV_P_ struct ev_timer *w, int revents)
89 {
90 /* puts (&quot;timeout&quot;); */
91 ev_unloop (EV_A_ EVUNLOOP_ONE); /* leave one loop call */
92 }
93
94 int
95 main (void)
96 {
97 struct ev_loop *loop = ev_default_loop (0);
98
99 /* initialise an io watcher, then start it */
100 ev_io_init (&amp;stdin_watcher, stdin_cb, /*STDIN_FILENO*/ 0, EV_READ);
101 ev_io_start (loop, &amp;stdin_watcher);
102
103 /* simple non-repeating 5.5 second timeout */
104 ev_timer_init (&amp;timeout_watcher, timeout_cb, 5.5, 0.);
105 ev_timer_start (loop, &amp;timeout_watcher);
106
107 /* loop till timeout or data ready */
108 ev_loop (loop, 0);
109
110 return 0;
111 }
72 112
73</pre> 113</pre>
74 114
75</div> 115</div>
76<h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p> 116<h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines