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

Comparing libev/ev.html (file contents):
Revision 1.72 by root, Sat Dec 8 15:30:29 2007 UTC vs.
Revision 1.73 by root, Sat Dec 8 22:11:14 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="Sat Dec 8 16:30:24 2007" /> 9 <meta name="created" content="Sat Dec 8 23:11:11 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 -->
529one iteration of the loop. This is useful if you are waiting for some 529one iteration of the loop. This is useful if you are waiting for some
530external event in conjunction with something not expressible using other 530external event in conjunction with something not expressible using other
531libev watchers. However, a pair of <code>ev_prepare</code>/<code>ev_check</code> watchers is 531libev watchers. However, a pair of <code>ev_prepare</code>/<code>ev_check</code> watchers is
532usually a better approach for this kind of thing.</p> 532usually a better approach for this kind of thing.</p>
533 <p>Here are the gory details of what <code>ev_loop</code> does:</p> 533 <p>Here are the gory details of what <code>ev_loop</code> does:</p>
534<pre> - Before the first iteration, call any pending watchers.
534<pre> * If there are no active watchers (reference count is zero), return. 535 * If there are no active watchers (reference count is zero), return.
535 - Queue prepare watchers and then call all outstanding watchers. 536 - Queue all prepare watchers and then call all outstanding watchers.
536 - If we have been forked, recreate the kernel state. 537 - If we have been forked, recreate the kernel state.
537 - Update the kernel state with all outstanding changes. 538 - Update the kernel state with all outstanding changes.
538 - Update the &quot;event loop time&quot;. 539 - Update the &quot;event loop time&quot;.
539 - Calculate for how long to block. 540 - Calculate for how long to block.
540 - Block the process, waiting for any events. 541 - Block the process, waiting for any events.
1483are ready to run (it's actually more complicated: it only runs coroutines 1484are ready to run (it's actually more complicated: it only runs coroutines
1484with priority higher than or equal to the event loop and one coroutine 1485with priority higher than or equal to the event loop and one coroutine
1485of lower priority, but only once, using idle watchers to keep the event 1486of lower priority, but only once, using idle watchers to keep the event
1486loop from blocking if lower-priority coroutines are active, thus mapping 1487loop from blocking if lower-priority coroutines are active, thus mapping
1487low-priority coroutines to idle/background tasks).</p> 1488low-priority coroutines to idle/background tasks).</p>
1489<p>It is recommended to give <code>ev_check</code> watchers highest (<code>EV_MAXPRI</code>)
1490priority, to ensure that they are being run before any other watchers
1491after the poll. Also, <code>ev_check</code> watchers (and <code>ev_prepare</code> watchers,
1492too) should not activate (&quot;feed&quot;) events into libev. While libev fully
1493supports this, they will be called before other <code>ev_check</code> watchers did
1494their job. As <code>ev_check</code> watchers are often used to embed other event
1495loops those other event loops might be in an unusable state until their
1496<code>ev_check</code> watcher ran (always remind yourself to coexist peacefully with
1497others).</p>
1488<dl> 1498<dl>
1489 <dt>ev_prepare_init (ev_prepare *, callback)</dt> 1499 <dt>ev_prepare_init (ev_prepare *, callback)</dt>
1490 <dt>ev_check_init (ev_check *, callback)</dt> 1500 <dt>ev_check_init (ev_check *, callback)</dt>
1491 <dd> 1501 <dd>
1492 <p>Initialises and configures the prepare or check watcher - they have no 1502 <p>Initialises and configures the prepare or check watcher - they have no

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines