This is how one would do it normally anyway, the important point is that
the libev application should not optimise around libev but should leave
optimisations to libev.
+.PP
+\fIWatcher-Specific Functions\fR
+.IX Subsection "Watcher-Specific Functions"
.IP "ev_io_init (ev_io *, callback, int fd, int events)" 4
.IX Item "ev_io_init (ev_io *, callback, int fd, int events)"
.PD 0
The callback is guarenteed to be invoked only when its timeout has passed,
but if multiple timers become ready during the same loop iteration then
order of execution is undefined.
+.PP
+\fIWatcher-Specific Functions and Data Members\fR
+.IX Subsection "Watcher-Specific Functions and Data Members"
.IP "ev_timer_init (ev_timer *, callback, ev_tstamp after, ev_tstamp repeat)" 4
.IX Item "ev_timer_init (ev_timer *, callback, ev_tstamp after, ev_tstamp repeat)"
.PD 0
As with timers, the callback is guarenteed to be invoked only when the
time (\f(CW\*(C`at\*(C'\fR) has been passed, but if multiple periodic timers become ready
during the same loop iteration then order of execution is undefined.
+.PP
+\fIWatcher-Specific Functions and Data Members\fR
+.IX Subsection "Watcher-Specific Functions and Data Members"
.IP "ev_periodic_init (ev_periodic *, callback, ev_tstamp at, ev_tstamp interval, reschedule_cb)" 4
.IX Item "ev_periodic_init (ev_periodic *, callback, ev_tstamp at, ev_tstamp interval, reschedule_cb)"
.PD 0
as you don't register any with libev). Similarly, when the last signal
watcher for a signal is stopped libev will reset the signal handler to
\&\s-1SIG_DFL\s0 (regardless of what it was set to before).
+.PP
+\fIWatcher-Specific Functions and Data Members\fR
+.IX Subsection "Watcher-Specific Functions and Data Members"
.IP "ev_signal_init (ev_signal *, callback, int signum)" 4
.IX Item "ev_signal_init (ev_signal *, callback, int signum)"
.PD 0
.IX Subsection "ev_child - watch out for process status changes"
Child watchers trigger when your process receives a \s-1SIGCHLD\s0 in response to
some child status changes (most typically when a child of yours dies).
+.PP
+\fIWatcher-Specific Functions and Data Members\fR
+.IX Subsection "Watcher-Specific Functions and Data Members"
.IP "ev_child_init (ev_child *, callback, int pid)" 4
.IX Item "ev_child_init (ev_child *, callback, int pid)"
.PD 0
to fall back to regular polling again even with inotify, but changes are
usually detected immediately, and if the file exists there will be no
polling.
+.PP
+\fIWatcher-Specific Functions and Data Members\fR
+.IX Subsection "Watcher-Specific Functions and Data Members"
.IP "ev_stat_init (ev_stat *, callback, const char *path, ev_tstamp interval)" 4
.IX Item "ev_stat_init (ev_stat *, callback, const char *path, ev_tstamp interval)"
.PD 0
effect on its own sometimes), idle watchers are a good place to do
\&\*(L"pseudo\-background processing\*(R", or delay processing stuff to after the
event loop has handled all outstanding events.
+.PP
+\fIWatcher-Specific Functions and Data Members\fR
+.IX Subsection "Watcher-Specific Functions and Data Members"
.IP "ev_idle_init (ev_signal *, callback)" 4
.IX Item "ev_idle_init (ev_signal *, callback)"
Initialises and configures the idle watcher \- it has no parameters of any
loops those other event loops might be in an unusable state until their
\&\f(CW\*(C`ev_check\*(C'\fR watcher ran (always remind yourself to coexist peacefully with
others).
+.PP
+\fIWatcher-Specific Functions and Data Members\fR
+.IX Subsection "Watcher-Specific Functions and Data Members"
.IP "ev_prepare_init (ev_prepare *, callback)" 4
.IX Item "ev_prepare_init (ev_prepare *, callback)"
.PD 0
\& else
\& loop_lo = loop_hi;
.Ve
+.PP
+\fIWatcher-Specific Functions and Data Members\fR
+.IX Subsection "Watcher-Specific Functions and Data Members"
.IP "ev_embed_init (ev_embed *, callback, struct ev_loop *embedded_loop)" 4
.IX Item "ev_embed_init (ev_embed *, callback, struct ev_loop *embedded_loop)"
.PD 0
<meta name="description" content="Pod documentation for libev" />
<meta name="inputfile" content="<standard input>" />
<meta name="outputfile" content="<standard output>" />
- <meta name="created" content="Wed Dec 12 05:53:55 2007" />
+ <meta name="created" content="Wed Dec 12 18:55:04 2007" />
<meta name="generator" content="Pod::Xhtml 1.57" />
<link rel="stylesheet" href="http://res.tst.eu/pod.css"/></head>
<body>
<li><a href="#WATCHER_TYPES">WATCHER TYPES</a>
<ul><li><a href="#code_ev_io_code_is_this_file_descrip"><code>ev_io</code> - is this file descriptor readable or writable?</a>
<ul><li><a href="#The_special_problem_of_disappearing_">The special problem of disappearing file descriptors</a></li>
+<li><a href="#Watcher_Specific_Functions">Watcher-Specific Functions</a></li>
+</ul>
+</li>
+<li><a href="#code_ev_timer_code_relative_and_opti"><code>ev_timer</code> - relative and optionally repeating timeouts</a>
+<ul><li><a href="#Watcher_Specific_Functions_and_Data_">Watcher-Specific Functions and Data Members</a></li>
+</ul>
+</li>
+<li><a href="#code_ev_periodic_code_to_cron_or_not"><code>ev_periodic</code> - to cron or not to cron?</a>
+<ul><li><a href="#Watcher_Specific_Functions_and_Data_-3">Watcher-Specific Functions and Data Members</a></li>
+</ul>
+</li>
+<li><a href="#code_ev_signal_code_signal_me_when_a"><code>ev_signal</code> - signal me when a signal gets signalled!</a>
+<ul><li><a href="#Watcher_Specific_Functions_and_Data_-4">Watcher-Specific Functions and Data Members</a></li>
+</ul>
+</li>
+<li><a href="#code_ev_child_code_watch_out_for_pro"><code>ev_child</code> - watch out for process status changes</a>
+<ul><li><a href="#Watcher_Specific_Functions_and_Data_-5">Watcher-Specific Functions and Data Members</a></li>
+</ul>
+</li>
+<li><a href="#code_ev_stat_code_did_the_file_attri"><code>ev_stat</code> - did the file attributes just change?</a>
+<ul><li><a href="#Watcher_Specific_Functions_and_Data_-6">Watcher-Specific Functions and Data Members</a></li>
+</ul>
+</li>
+<li><a href="#code_ev_idle_code_when_you_ve_got_no"><code>ev_idle</code> - when you've got nothing better to do...</a>
+<ul><li><a href="#Watcher_Specific_Functions_and_Data_-7">Watcher-Specific Functions and Data Members</a></li>
+</ul>
+</li>
+<li><a href="#code_ev_prepare_code_and_code_ev_che"><code>ev_prepare</code> and <code>ev_check</code> - customise your event loop!</a>
+<ul><li><a href="#Watcher_Specific_Functions_and_Data_-8">Watcher-Specific Functions and Data Members</a></li>
+</ul>
+</li>
+<li><a href="#code_ev_embed_code_when_one_backend_"><code>ev_embed</code> - when one backend isn't enough...</a>
+<ul><li><a href="#Watcher_Specific_Functions_and_Data_-9">Watcher-Specific Functions and Data Members</a></li>
</ul>
</li>
-<li><a href="#code_ev_timer_code_relative_and_opti"><code>ev_timer</code> - relative and optionally repeating timeouts</a></li>
-<li><a href="#code_ev_periodic_code_to_cron_or_not"><code>ev_periodic</code> - to cron or not to cron?</a></li>
-<li><a href="#code_ev_signal_code_signal_me_when_a"><code>ev_signal</code> - signal me when a signal gets signalled!</a></li>
-<li><a href="#code_ev_child_code_watch_out_for_pro"><code>ev_child</code> - watch out for process status changes</a></li>
-<li><a href="#code_ev_stat_code_did_the_file_attri"><code>ev_stat</code> - did the file attributes just change?</a></li>
-<li><a href="#code_ev_idle_code_when_you_ve_got_no"><code>ev_idle</code> - when you've got nothing better to do...</a></li>
-<li><a href="#code_ev_prepare_code_and_code_ev_che"><code>ev_prepare</code> and <code>ev_check</code> - customise your event loop!</a></li>
-<li><a href="#code_ev_embed_code_when_one_backend_"><code>ev_embed</code> - when one backend isn't enough...</a></li>
<li><a href="#code_ev_fork_code_the_audacity_to_re"><code>ev_fork</code> - the audacity to resume the event loop after a fork</a></li>
</ul>
</li>
+
+</div>
+<h3 id="Watcher_Specific_Functions">Watcher-Specific Functions</h3>
+<div id="Watcher_Specific_Functions_CONTENT">
<dl>
<dt>ev_io_init (ev_io *, callback, int fd, int events)</dt>
<dt>ev_io_set (ev_io *, int fd, int events)</dt>
<p>The callback is guarenteed to be invoked only when its timeout has passed,
but if multiple timers become ready during the same loop iteration then
order of execution is undefined.</p>
+
+</div>
+<h3 id="Watcher_Specific_Functions_and_Data_">Watcher-Specific Functions and Data Members</h3>
+<div id="Watcher_Specific_Functions_and_Data_-2">
<dl>
<dt>ev_timer_init (ev_timer *, callback, ev_tstamp after, ev_tstamp repeat)</dt>
<dt>ev_timer_set (ev_timer *, ev_tstamp after, ev_tstamp repeat)</dt>
<p>As with timers, the callback is guarenteed to be invoked only when the
time (<code>at</code>) has been passed, but if multiple periodic timers become ready
during the same loop iteration then order of execution is undefined.</p>
+
+</div>
+<h3 id="Watcher_Specific_Functions_and_Data_-3">Watcher-Specific Functions and Data Members</h3>
+<div id="Watcher_Specific_Functions_and_Data_-2">
<dl>
<dt>ev_periodic_init (ev_periodic *, callback, ev_tstamp at, ev_tstamp interval, reschedule_cb)</dt>
<dt>ev_periodic_set (ev_periodic *, ev_tstamp after, ev_tstamp repeat, reschedule_cb)</dt>
as you don't register any with libev). Similarly, when the last signal
watcher for a signal is stopped libev will reset the signal handler to
SIG_DFL (regardless of what it was set to before).</p>
+
+</div>
+<h3 id="Watcher_Specific_Functions_and_Data_-4">Watcher-Specific Functions and Data Members</h3>
+<div id="Watcher_Specific_Functions_and_Data_-2-2">
<dl>
<dt>ev_signal_init (ev_signal *, callback, int signum)</dt>
<dt>ev_signal_set (ev_signal *, int signum)</dt>
<div id="code_ev_child_code_watch_out_for_pro-2">
<p>Child watchers trigger when your process receives a SIGCHLD in response to
some child status changes (most typically when a child of yours dies).</p>
+
+</div>
+<h3 id="Watcher_Specific_Functions_and_Data_-5">Watcher-Specific Functions and Data Members</h3>
+<div id="Watcher_Specific_Functions_and_Data_-2-3">
<dl>
<dt>ev_child_init (ev_child *, callback, int pid)</dt>
<dt>ev_child_set (ev_child *, int pid)</dt>
to fall back to regular polling again even with inotify, but changes are
usually detected immediately, and if the file exists there will be no
polling.</p>
+
+</div>
+<h3 id="Watcher_Specific_Functions_and_Data_-6">Watcher-Specific Functions and Data Members</h3>
+<div id="Watcher_Specific_Functions_and_Data_-2-4">
<dl>
<dt>ev_stat_init (ev_stat *, callback, const char *path, ev_tstamp interval)</dt>
<dt>ev_stat_set (ev_stat *, const char *path, ev_tstamp interval)</dt>
effect on its own sometimes), idle watchers are a good place to do
"pseudo-background processing", or delay processing stuff to after the
event loop has handled all outstanding events.</p>
+
+</div>
+<h3 id="Watcher_Specific_Functions_and_Data_-7">Watcher-Specific Functions and Data Members</h3>
+<div id="Watcher_Specific_Functions_and_Data_-2-5">
<dl>
<dt>ev_idle_init (ev_signal *, callback)</dt>
<dd>
loops those other event loops might be in an unusable state until their
<code>ev_check</code> watcher ran (always remind yourself to coexist peacefully with
others).</p>
+
+</div>
+<h3 id="Watcher_Specific_Functions_and_Data_-8">Watcher-Specific Functions and Data Members</h3>
+<div id="Watcher_Specific_Functions_and_Data_-2-6">
<dl>
<dt>ev_prepare_init (ev_prepare *, callback)</dt>
<dt>ev_check_init (ev_check *, callback)</dt>
loop_lo = loop_hi;
</pre>
+
+</div>
+<h3 id="Watcher_Specific_Functions_and_Data_-9">Watcher-Specific Functions and Data Members</h3>
+<div id="Watcher_Specific_Functions_and_Data_-2-7">
<dl>
<dt>ev_embed_init (ev_embed *, callback, struct ev_loop *embedded_loop)</dt>
<dt>ev_embed_set (ev_embed *, callback, struct ev_loop *embedded_loop)</dt>
optimisations to libev.
+=head3 Watcher-Specific Functions
+
=over 4
=item ev_io_init (ev_io *, callback, int fd, int events)
but if multiple timers become ready during the same loop iteration then
order of execution is undefined.
+=head3 Watcher-Specific Functions and Data Members
+
=over 4
=item ev_timer_init (ev_timer *, callback, ev_tstamp after, ev_tstamp repeat)
time (C<at>) has been passed, but if multiple periodic timers become ready
during the same loop iteration then order of execution is undefined.
+=head3 Watcher-Specific Functions and Data Members
+
=over 4
=item ev_periodic_init (ev_periodic *, callback, ev_tstamp at, ev_tstamp interval, reschedule_cb)
watcher for a signal is stopped libev will reset the signal handler to
SIG_DFL (regardless of what it was set to before).
+=head3 Watcher-Specific Functions and Data Members
+
=over 4
=item ev_signal_init (ev_signal *, callback, int signum)
Child watchers trigger when your process receives a SIGCHLD in response to
some child status changes (most typically when a child of yours dies).
+=head3 Watcher-Specific Functions and Data Members
+
=over 4
=item ev_child_init (ev_child *, callback, int pid)
usually detected immediately, and if the file exists there will be no
polling.
+=head3 Watcher-Specific Functions and Data Members
+
=over 4
=item ev_stat_init (ev_stat *, callback, const char *path, ev_tstamp interval)
"pseudo-background processing", or delay processing stuff to after the
event loop has handled all outstanding events.
+=head3 Watcher-Specific Functions and Data Members
+
=over 4
=item ev_idle_init (ev_signal *, callback)
C<ev_check> watcher ran (always remind yourself to coexist peacefully with
others).
+=head3 Watcher-Specific Functions and Data Members
+
=over 4
=item ev_prepare_init (ev_prepare *, callback)
else
loop_lo = loop_hi;
+=head3 Watcher-Specific Functions and Data Members
+
=over 4
=item ev_embed_init (ev_embed *, callback, struct ev_loop *embedded_loop)