-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwatch_8h.html
357 lines (333 loc) · 19.9 KB
/
watch_8h.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libevent: event2/watch.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">libevent
 <span id="projectnumber">2.2.1</span>
</div>
<div id="projectbrief">Event notification library</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_db160b4728e6067cf5f9cc14ec42c79d.html">event2</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#typedef-members">Typedefs</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">watch.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>"Prepare" and "check" watchers.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include <event2/visibility.h></code><br />
</div>
<p><a href="watch_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a552db1e01295811adc2191580a48f3f7"><td class="memItemLeft" align="right" valign="top">typedef void(* </td><td class="memItemRight" valign="bottom"><a class="el" href="watch_8h.html#a552db1e01295811adc2191580a48f3f7">evwatch_check_cb</a>) (struct evwatch *, const struct evwatch_check_cb_info *, void *)</td></tr>
<tr class="memdesc:a552db1e01295811adc2191580a48f3f7"><td class="mdescLeft"> </td><td class="mdescRight">Check callback, invoked by event_base_loop immediately after polling for I/O and before processing any active events. <a href="watch_8h.html#a552db1e01295811adc2191580a48f3f7">More...</a><br /></td></tr>
<tr class="separator:a552db1e01295811adc2191580a48f3f7"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab49b34b1552c9cc5e6a736cfc435c766"><td class="memItemLeft" align="right" valign="top">typedef void(* </td><td class="memItemRight" valign="bottom"><a class="el" href="watch_8h.html#ab49b34b1552c9cc5e6a736cfc435c766">evwatch_prepare_cb</a>) (struct evwatch *, const struct evwatch_prepare_cb_info *, void *)</td></tr>
<tr class="memdesc:ab49b34b1552c9cc5e6a736cfc435c766"><td class="mdescLeft"> </td><td class="mdescRight">Prepare callback, invoked by event_base_loop immediately before polling for I/O. <a href="watch_8h.html#ab49b34b1552c9cc5e6a736cfc435c766">More...</a><br /></td></tr>
<tr class="separator:ab49b34b1552c9cc5e6a736cfc435c766"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a12f916b5846e7925939abbaca49b4521"><td class="memItemLeft" align="right" valign="top">EVENT2_EXPORT_SYMBOL struct <a class="el" href="structevent__base.html">event_base</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="watch_8h.html#a12f916b5846e7925939abbaca49b4521">evwatch_base</a> (struct evwatch *watcher)</td></tr>
<tr class="memdesc:a12f916b5846e7925939abbaca49b4521"><td class="mdescLeft"> </td><td class="mdescRight">Get the <a class="el" href="structevent__base.html" title="Structure to hold information and state for a Libevent dispatch loop.">event_base</a> that a given evwatch is registered with. <a href="watch_8h.html#a12f916b5846e7925939abbaca49b4521">More...</a><br /></td></tr>
<tr class="separator:a12f916b5846e7925939abbaca49b4521"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:acfeaa9fc345062e41c7f807d6c5d511f"><td class="memItemLeft" align="right" valign="top">EVENT2_EXPORT_SYMBOL struct evwatch * </td><td class="memItemRight" valign="bottom"><a class="el" href="watch_8h.html#acfeaa9fc345062e41c7f807d6c5d511f">evwatch_check_new</a> (struct <a class="el" href="structevent__base.html">event_base</a> *base, <a class="el" href="watch_8h.html#a552db1e01295811adc2191580a48f3f7">evwatch_check_cb</a> callback, void *arg)</td></tr>
<tr class="memdesc:acfeaa9fc345062e41c7f807d6c5d511f"><td class="mdescLeft"> </td><td class="mdescRight">Register a new "check" watcher, to be called in the event loop after polling for events and before handling them. <a href="watch_8h.html#acfeaa9fc345062e41c7f807d6c5d511f">More...</a><br /></td></tr>
<tr class="separator:acfeaa9fc345062e41c7f807d6c5d511f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aadf0c377890835ae40612b19f9029032"><td class="memItemLeft" align="right" valign="top">EVENT2_EXPORT_SYMBOL void </td><td class="memItemRight" valign="bottom"><a class="el" href="watch_8h.html#aadf0c377890835ae40612b19f9029032">evwatch_free</a> (struct evwatch *watcher)</td></tr>
<tr class="memdesc:aadf0c377890835ae40612b19f9029032"><td class="mdescLeft"> </td><td class="mdescRight">Deregister and deallocate a watcher. <a href="watch_8h.html#aadf0c377890835ae40612b19f9029032">More...</a><br /></td></tr>
<tr class="separator:aadf0c377890835ae40612b19f9029032"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a5f7837d8af2b00c9ec401e00b4f33781"><td class="memItemLeft" align="right" valign="top">EVENT2_EXPORT_SYMBOL int </td><td class="memItemRight" valign="bottom"><a class="el" href="watch_8h.html#a5f7837d8af2b00c9ec401e00b4f33781">evwatch_prepare_get_timeout</a> (const struct evwatch_prepare_cb_info *info, struct timeval *timeout)</td></tr>
<tr class="memdesc:a5f7837d8af2b00c9ec401e00b4f33781"><td class="mdescLeft"> </td><td class="mdescRight">Get the timeout (the expected polling duration) passed to the underlying implementation's <code>dispatch</code>. <a href="watch_8h.html#a5f7837d8af2b00c9ec401e00b4f33781">More...</a><br /></td></tr>
<tr class="separator:a5f7837d8af2b00c9ec401e00b4f33781"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad446340d54b8de7125cae9d5fed9c61e"><td class="memItemLeft" align="right" valign="top">EVENT2_EXPORT_SYMBOL struct evwatch * </td><td class="memItemRight" valign="bottom"><a class="el" href="watch_8h.html#ad446340d54b8de7125cae9d5fed9c61e">evwatch_prepare_new</a> (struct <a class="el" href="structevent__base.html">event_base</a> *base, <a class="el" href="watch_8h.html#ab49b34b1552c9cc5e6a736cfc435c766">evwatch_prepare_cb</a> callback, void *arg)</td></tr>
<tr class="memdesc:ad446340d54b8de7125cae9d5fed9c61e"><td class="mdescLeft"> </td><td class="mdescRight">Register a new "prepare" watcher, to be called in the event loop prior to polling for events. <a href="watch_8h.html#ad446340d54b8de7125cae9d5fed9c61e">More...</a><br /></td></tr>
<tr class="separator:ad446340d54b8de7125cae9d5fed9c61e"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>"Prepare" and "check" watchers. </p>
<p>"Prepare" and "check" watchers. A "prepare" watcher is a callback that fires immediately before polling for I/O. A "check" watcher is a callback that fires immediately after polling and before processing any active events. This may be useful for embedding other libraries' event loops (e.g. UI toolkits) into libevent's. </p>
</div><h2 class="groupheader">Typedef Documentation</h2>
<a id="a552db1e01295811adc2191580a48f3f7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a552db1e01295811adc2191580a48f3f7">◆ </a></span>evwatch_check_cb</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef void(* evwatch_check_cb) (struct evwatch *, const struct evwatch_check_cb_info *, void *)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Check callback, invoked by event_base_loop immediately after polling for I/O and before processing any active events. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">watcher</td><td>the check watcher that invoked this callback. </td></tr>
<tr><td class="paramname">info</td><td>contextual information passed from event_base_loop. </td></tr>
<tr><td class="paramname">arg</td><td>additional user-defined argument, set in <code>evwatch_check_new</code>. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ab49b34b1552c9cc5e6a736cfc435c766"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab49b34b1552c9cc5e6a736cfc435c766">◆ </a></span>evwatch_prepare_cb</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef void(* evwatch_prepare_cb) (struct evwatch *, const struct evwatch_prepare_cb_info *, void *)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Prepare callback, invoked by event_base_loop immediately before polling for I/O. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">watcher</td><td>the prepare watcher that invoked this callback. </td></tr>
<tr><td class="paramname">info</td><td>contextual information passed from event_base_loop. </td></tr>
<tr><td class="paramname">arg</td><td>additional user-defined argument, set in <code>evwatch_prepare_new</code>. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a12f916b5846e7925939abbaca49b4521"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a12f916b5846e7925939abbaca49b4521">◆ </a></span>evwatch_base()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">EVENT2_EXPORT_SYMBOL struct <a class="el" href="structevent__base.html">event_base</a>* evwatch_base </td>
<td>(</td>
<td class="paramtype">struct evwatch * </td>
<td class="paramname"><em>watcher</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the <a class="el" href="structevent__base.html" title="Structure to hold information and state for a Libevent dispatch loop.">event_base</a> that a given evwatch is registered with. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">watcher</td><td>the watcher to get the <a class="el" href="structevent__base.html" title="Structure to hold information and state for a Libevent dispatch loop.">event_base</a> for. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the <a class="el" href="structevent__base.html" title="Structure to hold information and state for a Libevent dispatch loop.">event_base</a> for the given watcher. </dd></dl>
</div>
</div>
<a id="acfeaa9fc345062e41c7f807d6c5d511f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acfeaa9fc345062e41c7f807d6c5d511f">◆ </a></span>evwatch_check_new()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">EVENT2_EXPORT_SYMBOL struct evwatch* evwatch_check_new </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structevent__base.html">event_base</a> * </td>
<td class="paramname"><em>base</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="watch_8h.html#a552db1e01295811adc2191580a48f3f7">evwatch_check_cb</a> </td>
<td class="paramname"><em>callback</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void * </td>
<td class="paramname"><em>arg</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Register a new "check" watcher, to be called in the event loop after polling for events and before handling them. </p>
<p>Watchers will be called in the order they were registered.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">base</td><td>the <a class="el" href="structevent__base.html" title="Structure to hold information and state for a Libevent dispatch loop.">event_base</a> to operate on. </td></tr>
<tr><td class="paramname">callback</td><td>the callback function to invoke. </td></tr>
<tr><td class="paramname">arg</td><td>additional user-defined argument provided to the callback. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer to the newly allocated event watcher. </dd></dl>
</div>
</div>
<a id="aadf0c377890835ae40612b19f9029032"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aadf0c377890835ae40612b19f9029032">◆ </a></span>evwatch_free()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">EVENT2_EXPORT_SYMBOL void evwatch_free </td>
<td>(</td>
<td class="paramtype">struct evwatch * </td>
<td class="paramname"><em>watcher</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Deregister and deallocate a watcher. </p>
<p>Any watchers not freed using evwatch_free will eventually be deallocated in event_base_free (calling evwatch_free on a watcher after event_base_free has been called on its corresponding <a class="el" href="structevent__base.html" title="Structure to hold information and state for a Libevent dispatch loop.">event_base</a> is an error).</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">watcher</td><td>the watcher to deregister and deallocate. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a5f7837d8af2b00c9ec401e00b4f33781"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5f7837d8af2b00c9ec401e00b4f33781">◆ </a></span>evwatch_prepare_get_timeout()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">EVENT2_EXPORT_SYMBOL int evwatch_prepare_get_timeout </td>
<td>(</td>
<td class="paramtype">const struct evwatch_prepare_cb_info * </td>
<td class="paramname"><em>info</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct timeval * </td>
<td class="paramname"><em>timeout</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the timeout (the expected polling duration) passed to the underlying implementation's <code>dispatch</code>. </p>
<p>This value will only be set if there are pending EV_TIMEOUT events and if the <a class="el" href="structevent__base.html" title="Structure to hold information and state for a Libevent dispatch loop.">event_base</a> isn't in EVLOOP_NONBLOCK mode. It may be a useful performance statistic to compare the expected polling duration against the actual polling duration (that is, the time difference measured between this prepare callback and the following check callback).</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">info</td><td>the "prepare" callback info. </td></tr>
<tr><td class="paramname">timeout</td><td>address of a timeval to write the polling duration to. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>1 if a value was written to *timeout, or 0 if not. </dd></dl>
</div>
</div>
<a id="ad446340d54b8de7125cae9d5fed9c61e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad446340d54b8de7125cae9d5fed9c61e">◆ </a></span>evwatch_prepare_new()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">EVENT2_EXPORT_SYMBOL struct evwatch* evwatch_prepare_new </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structevent__base.html">event_base</a> * </td>
<td class="paramname"><em>base</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="watch_8h.html#ab49b34b1552c9cc5e6a736cfc435c766">evwatch_prepare_cb</a> </td>
<td class="paramname"><em>callback</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void * </td>
<td class="paramname"><em>arg</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Register a new "prepare" watcher, to be called in the event loop prior to polling for events. </p>
<p>Watchers will be called in the order they were registered.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">base</td><td>the <a class="el" href="structevent__base.html" title="Structure to hold information and state for a Libevent dispatch loop.">event_base</a> to operate on. </td></tr>
<tr><td class="paramname">callback</td><td>the callback function to invoke. </td></tr>
<tr><td class="paramname">arg</td><td>additional user-defined argument provided to the callback. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer to the newly allocated event watcher. </dd></dl>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>