File: libvirt-libvirt-event.html

package info (click to toggle)
libvirt 5.0.0-4%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 251,264 kB
  • sloc: ansic: 573,843; xml: 168,347; sh: 9,976; python: 4,883; perl: 3,953; makefile: 3,323; ml: 465
file content (576 lines) | stat: -rw-r--r-- 33,159 bytes parent folder | download
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
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <!--
        This file is autogenerated from html/libvirt-libvirt-event.html.in
        Do not edit this file. Changes will be lost.
      -->
  <!--
        This page was generated at Thu Jan 10 20:48:18 UTC 2019.
      -->
  <head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <link rel="stylesheet" type="text/css" href="../main.css"/>
    <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"/>
    <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/>
    <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/>
    <link rel="manifest" href="/manifest.json"/>
    <meta name="theme-color" content="#ffffff"/>
    <title>libvirt: Module libvirt-event from libvirt</title>
    <meta name="description" content="libvirt, virtualization, virtualization API"/>
    <script type="text/javascript">
      <!--
          
      function init() {
          window.addEventListener('scroll', function(e){
              var distanceY = window.pageYOffset || document.documentElement.scrollTop,
              shrinkOn = 94
              home = document.getElementById("home");
              links = document.getElementById("jumplinks");
              search = document.getElementById("search");
              body = document.getElementById("body");
              if (distanceY > shrinkOn) {
                  if (home.className != "navhide") {
                      body.className = "navhide"
                      home.className = "navhide"
                      links.className = "navhide"
                      search.className = "navhide"
                  }
              } else {
                  if (home.className == "navhide") {
                      body.className = ""
                      home.className = ""
                      links.className = ""
                      search.className = ""
                  }
              }
          });
      }
      window.onload = init();
           
          -->
    </script>
  </head>
  <body>
    <div id="body">
      <div id="content">
        <h1>Module libvirt-event from libvirt</h1>
        <p>Provides APIs for the management of events Copyright (C) 2006-2014 Red Hat, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.</p>
        <h2>Table of Contents</h2>
        <h3>
          <a href="#types">Types</a>
        </h3>
        <pre class="api"><span class="keyword">typedef</span> <span class="keyword">enum</span> <a href="#virEventHandleType">virEventHandleType</a>
</pre>
        <h3>
          <a href="#functions">Functions</a>
        </h3>
        <pre class="api"><span class="type">int</span>	<a href="#virEventAddHandle">virEventAddHandle</a>		(<span class="type">int</span> fd, <br/>					 <span class="type">int</span> events, <br/>					 <span class="type"><a href="libvirt-libvirt-event.html#virEventHandleCallback">virEventHandleCallback</a></span> cb, <br/>					 <span class="type">void *</span> opaque, <br/>					 <span class="type"><a href="libvirt-libvirt-common.html#virFreeCallback">virFreeCallback</a></span> ff)
<span class="keyword">typedef</span> <a href="#virEventAddHandleFunc">virEventAddHandleFunc</a>
<span class="type">int</span>	<a href="#virEventAddHandleFunc">virEventAddHandleFunc</a>		(<span class="type">int</span> fd, <br/>					 <span class="type">int</span> event, <br/>					 <span class="type"><a href="libvirt-libvirt-event.html#virEventHandleCallback">virEventHandleCallback</a></span> cb, <br/>					 <span class="type">void *</span> opaque, <br/>					 <span class="type"><a href="libvirt-libvirt-common.html#virFreeCallback">virFreeCallback</a></span> ff)

<span class="type">int</span>	<a href="#virEventAddTimeout">virEventAddTimeout</a>		(<span class="type">int</span> timeout, <br/>					 <span class="type"><a href="libvirt-libvirt-event.html#virEventTimeoutCallback">virEventTimeoutCallback</a></span> cb, <br/>					 <span class="type">void *</span> opaque, <br/>					 <span class="type"><a href="libvirt-libvirt-common.html#virFreeCallback">virFreeCallback</a></span> ff)
<span class="keyword">typedef</span> <a href="#virEventAddTimeoutFunc">virEventAddTimeoutFunc</a>
<span class="type">int</span>	<a href="#virEventAddTimeoutFunc">virEventAddTimeoutFunc</a>		(<span class="type">int</span> timeout, <br/>					 <span class="type"><a href="libvirt-libvirt-event.html#virEventTimeoutCallback">virEventTimeoutCallback</a></span> cb, <br/>					 <span class="type">void *</span> opaque, <br/>					 <span class="type"><a href="libvirt-libvirt-common.html#virFreeCallback">virFreeCallback</a></span> ff)

<span class="keyword">typedef</span> <a href="#virEventHandleCallback">virEventHandleCallback</a>
<span class="type">void</span>	<a href="#virEventHandleCallback">virEventHandleCallback</a>		(<span class="type">int</span> watch, <br/>					 <span class="type">int</span> fd, <br/>					 <span class="type">int</span> events, <br/>					 <span class="type">void *</span> opaque)

<span class="type">int</span>	<a href="#virEventRegisterDefaultImpl">virEventRegisterDefaultImpl</a>	(<span class="type">void</span>)
<span class="type">void</span>	<a href="#virEventRegisterImpl">virEventRegisterImpl</a>		(<span class="type"><a href="libvirt-libvirt-event.html#virEventAddHandleFunc">virEventAddHandleFunc</a></span> addHandle, <br/>					 <span class="type"><a href="libvirt-libvirt-event.html#virEventUpdateHandleFunc">virEventUpdateHandleFunc</a></span> updateHandle, <br/>					 <span class="type"><a href="libvirt-libvirt-event.html#virEventRemoveHandleFunc">virEventRemoveHandleFunc</a></span> removeHandle, <br/>					 <span class="type"><a href="libvirt-libvirt-event.html#virEventAddTimeoutFunc">virEventAddTimeoutFunc</a></span> addTimeout, <br/>					 <span class="type"><a href="libvirt-libvirt-event.html#virEventUpdateTimeoutFunc">virEventUpdateTimeoutFunc</a></span> updateTimeout, <br/>					 <span class="type"><a href="libvirt-libvirt-event.html#virEventRemoveTimeoutFunc">virEventRemoveTimeoutFunc</a></span> removeTimeout)
<span class="type">int</span>	<a href="#virEventRemoveHandle">virEventRemoveHandle</a>		(<span class="type">int</span> watch)
<span class="keyword">typedef</span> <a href="#virEventRemoveHandleFunc">virEventRemoveHandleFunc</a>
<span class="type">int</span>	<a href="#virEventRemoveHandleFunc">virEventRemoveHandleFunc</a>	(<span class="type">int</span> watch)

<span class="type">int</span>	<a href="#virEventRemoveTimeout">virEventRemoveTimeout</a>		(<span class="type">int</span> timer)
<span class="keyword">typedef</span> <a href="#virEventRemoveTimeoutFunc">virEventRemoveTimeoutFunc</a>
<span class="type">int</span>	<a href="#virEventRemoveTimeoutFunc">virEventRemoveTimeoutFunc</a>	(<span class="type">int</span> timer)

<span class="type">int</span>	<a href="#virEventRunDefaultImpl">virEventRunDefaultImpl</a>		(<span class="type">void</span>)
<span class="keyword">typedef</span> <a href="#virEventTimeoutCallback">virEventTimeoutCallback</a>
<span class="type">void</span>	<a href="#virEventTimeoutCallback">virEventTimeoutCallback</a>		(<span class="type">int</span> timer, <br/>					 <span class="type">void *</span> opaque)

<span class="type">void</span>	<a href="#virEventUpdateHandle">virEventUpdateHandle</a>		(<span class="type">int</span> watch, <br/>					 <span class="type">int</span> events)
<span class="keyword">typedef</span> <a href="#virEventUpdateHandleFunc">virEventUpdateHandleFunc</a>
<span class="type">void</span>	<a href="#virEventUpdateHandleFunc">virEventUpdateHandleFunc</a>	(<span class="type">int</span> watch, <br/>					 <span class="type">int</span> event)

<span class="type">void</span>	<a href="#virEventUpdateTimeout">virEventUpdateTimeout</a>		(<span class="type">int</span> timer, <br/>					 <span class="type">int</span> timeout)
<span class="keyword">typedef</span> <a href="#virEventUpdateTimeoutFunc">virEventUpdateTimeoutFunc</a>
<span class="type">void</span>	<a href="#virEventUpdateTimeoutFunc">virEventUpdateTimeoutFunc</a>	(<span class="type">int</span> timer, <br/>					 <span class="type">int</span> timeout)

</pre>
        <h2>Description</h2>
        <h3>
          <a name="types">Types</a>
        </h3>
        <h3>
          <a name="virEventHandleType">
            <code>virEventHandleType</code>
          </a>
        </h3>
        <div class="api">
          <pre><span class="keyword">enum</span> virEventHandleType {
</pre>
          <table>
            <tr>
              <td>
                <a name="VIR_EVENT_HANDLE_READABLE">VIR_EVENT_HANDLE_READABLE</a>
              </td>
              <td> = </td>
              <td colspan="2">1</td>
            </tr>
            <tr>
              <td>
                <a name="VIR_EVENT_HANDLE_WRITABLE">VIR_EVENT_HANDLE_WRITABLE</a>
              </td>
              <td> = </td>
              <td colspan="2">2</td>
            </tr>
            <tr>
              <td>
                <a name="VIR_EVENT_HANDLE_ERROR">VIR_EVENT_HANDLE_ERROR</a>
              </td>
              <td> = </td>
              <td colspan="2">4</td>
            </tr>
            <tr>
              <td>
                <a name="VIR_EVENT_HANDLE_HANGUP">VIR_EVENT_HANDLE_HANGUP</a>
              </td>
              <td> = </td>
              <td colspan="2">8</td>
            </tr>
          </table>
          <pre>}
</pre>
        </div>
        <h3>
          <a name="functions">Functions</a>
        </h3>
        <h3>
          <a name="virEventAddHandle">
            <code>virEventAddHandle</code>
          </a>
        </h3>
        <pre class="api"><span class="type">int</span>	virEventAddHandle		(<span class="type">int</span> fd,
					 <span class="type">int</span> events,
					 <span class="type"><a href="libvirt-libvirt-event.html#virEventHandleCallback">virEventHandleCallback</a></span> cb,
					 <span class="type">void *</span> opaque,
					 <span class="type"><a href="libvirt-libvirt-common.html#virFreeCallback">virFreeCallback</a></span> ff)</pre>
        <div class="description">
          <p>Register a callback for monitoring file handle events. This function requires that an event loop has previously been registered with <a href="libvirt-libvirt-event.html#virEventRegisterImpl">virEventRegisterImpl</a>() or <a href="libvirt-libvirt-event.html#virEventRegisterDefaultImpl">virEventRegisterDefaultImpl</a>().</p>
        </div>
        <dl class="variablelist">
          <dt>fd</dt>
          <dd>file handle to monitor for events</dd>
          <dt>events</dt>
          <dd>bitset of events to watch from <a href="libvirt-libvirt-event.html#virEventHandleType">virEventHandleType</a> constants</dd>
          <dt>cb</dt>
          <dd>callback to invoke when an event occurs</dd>
          <dt>opaque</dt>
          <dd>user data to pass to callback</dd>
          <dt>ff</dt>
          <dd>callback to free opaque when handle is removed</dd>
          <dt>Returns</dt>
          <dd>-1 if the file handle cannot be registered, otherwise a handle watch number to be used for updating and unregistering for events.</dd>
        </dl>
        <div class="acl"/>
        <h3>
          <a name="virEventAddHandleFunc">
            <code>virEventAddHandleFunc</code>
          </a>
        </h3>
        <pre class="api"><span class="keyword">typedef</span> <span class="type">int</span>	(*virEventAddHandleFunc	)	(<span class="type">int</span> fd,
					 <span class="type">int</span> event,
					 <span class="type"><a href="libvirt-libvirt-event.html#virEventHandleCallback">virEventHandleCallback</a></span> cb,
					 <span class="type">void *</span> opaque,
					 <span class="type"><a href="libvirt-libvirt-common.html#virFreeCallback">virFreeCallback</a></span> ff)
</pre>
        <div class="description">
          <p>Part of the EventImpl, this callback adds a file handle callback to listen for specific events. The same file handle can be registered multiple times provided the requested event sets are non-overlapping</p>
          <p>If the opaque user data requires free'ing when the handle is unregistered, then a 2nd callback can be supplied for this purpose. This callback needs to be invoked from a clean stack. If 'ff' callbacks are invoked directly from the <a href="libvirt-libvirt-event.html#virEventRemoveHandleFunc">virEventRemoveHandleFunc</a> they will likely deadlock in libvirt.</p>
        </div>
        <dl class="variablelist">
          <dt>fd</dt>
          <dd>file descriptor to listen on</dd>
          <dt>event</dt>
          <dd>bitset of events on which to fire the callback</dd>
          <dt>cb</dt>
          <dd>the callback to be called when an event occurs</dd>
          <dt>opaque</dt>
          <dd>user data to pass to the callback</dd>
          <dt>ff</dt>
          <dd>the callback invoked to free opaque data blob</dd>
          <dt>Returns</dt>
          <dd>-1 if the file handle cannot be registered, otherwise a handle watch number to be used for updating and unregistering for events</dd>
        </dl>
        <br/>
        <h3>
          <a name="virEventAddTimeout">
            <code>virEventAddTimeout</code>
          </a>
        </h3>
        <pre class="api"><span class="type">int</span>	virEventAddTimeout		(<span class="type">int</span> timeout,
					 <span class="type"><a href="libvirt-libvirt-event.html#virEventTimeoutCallback">virEventTimeoutCallback</a></span> cb,
					 <span class="type">void *</span> opaque,
					 <span class="type"><a href="libvirt-libvirt-common.html#virFreeCallback">virFreeCallback</a></span> ff)</pre>
        <div class="description">
          <p>Register a callback for a timer event. This function requires that an event loop has previously been registered with <a href="libvirt-libvirt-event.html#virEventRegisterImpl">virEventRegisterImpl</a>() or <a href="libvirt-libvirt-event.html#virEventRegisterDefaultImpl">virEventRegisterDefaultImpl</a>().</p>
          <p>Setting @timeout to -1 will disable the timer. Setting @timeout to zero will cause it to fire on every event loop iteration.</p>
        </div>
        <dl class="variablelist">
          <dt>timeout</dt>
          <dd>time between events in milliseconds</dd>
          <dt>cb</dt>
          <dd>callback to invoke when an event occurs</dd>
          <dt>opaque</dt>
          <dd>user data to pass to callback</dd>
          <dt>ff</dt>
          <dd>callback to free opaque when timeout is removed</dd>
          <dt>Returns</dt>
          <dd>-1 if the timer cannot be registered, a positive integer timer id upon success.</dd>
        </dl>
        <div class="acl"/>
        <h3>
          <a name="virEventAddTimeoutFunc">
            <code>virEventAddTimeoutFunc</code>
          </a>
        </h3>
        <pre class="api"><span class="keyword">typedef</span> <span class="type">int</span>	(*virEventAddTimeoutFunc	)	(<span class="type">int</span> timeout,
					 <span class="type"><a href="libvirt-libvirt-event.html#virEventTimeoutCallback">virEventTimeoutCallback</a></span> cb,
					 <span class="type">void *</span> opaque,
					 <span class="type"><a href="libvirt-libvirt-common.html#virFreeCallback">virFreeCallback</a></span> ff)
</pre>
        <div class="description">
          <p>Part of the EventImpl, this user-defined callback handles adding an event timeout.</p>
          <p>If the opaque user data requires free'ing when the handle is unregistered, then a 2nd callback can be supplied for this purpose.</p>
        </div>
        <dl class="variablelist">
          <dt>timeout</dt>
          <dd>The timeout to monitor</dd>
          <dt>cb</dt>
          <dd>the callback to call when timeout has expired</dd>
          <dt>opaque</dt>
          <dd>user data to pass to the callback</dd>
          <dt>ff</dt>
          <dd>the callback invoked to free opaque data blob</dd>
          <dt>Returns</dt>
          <dd>a timer value</dd>
        </dl>
        <br/>
        <h3>
          <a name="virEventHandleCallback">
            <code>virEventHandleCallback</code>
          </a>
        </h3>
        <pre class="api"><span class="keyword">typedef</span> <span class="type">void</span>	(*virEventHandleCallback	)	(<span class="type">int</span> watch,
					 <span class="type">int</span> fd,
					 <span class="type">int</span> events,
					 <span class="type">void *</span> opaque)
</pre>
        <div class="description">
          <p>Callback for receiving file handle events. The callback will be invoked once for each event which is pending.</p>
        </div>
        <dl class="variablelist">
          <dt>watch</dt>
          <dd>watch on which the event occurred</dd>
          <dt>fd</dt>
          <dd>file handle on which the event occurred</dd>
          <dt>events</dt>
          <dd>bitset of events from <a href="libvirt-libvirt-event.html#virEventHandleType">virEventHandleType</a> constants</dd>
          <dt>opaque</dt>
          <dd>user data registered with handle</dd>
        </dl>
        <br/>
        <h3>
          <a name="virEventRegisterDefaultImpl">
            <code>virEventRegisterDefaultImpl</code>
          </a>
        </h3>
        <pre class="api"><span class="type">int</span>	virEventRegisterDefaultImpl	(<span class="type">void</span>)</pre>
        <div class="description">
          <p>Registers a default event implementation based on the poll() system call. This is a generic implementation that can be used by any client application which does not have a need to integrate with an external event loop impl.</p>
          <p>For proper event handling, it is important that the event implementation is registered before a connection to the Hypervisor is opened.</p>
          <p>Once registered, the application has to invoke <a href="libvirt-libvirt-event.html#virEventRunDefaultImpl">virEventRunDefaultImpl</a>() in a loop to process events. Failure to do so may result in connections being closed unexpectedly as a result of keepalive timeout. The default event loop fully supports handle and timeout events, but only wakes up on events registered by libvirt API calls such as <a href="libvirt-libvirt-event.html#virEventAddHandle">virEventAddHandle</a>() or <a href="libvirt-libvirt-domain.html#virConnectDomainEventRegisterAny">virConnectDomainEventRegisterAny</a>().</p>
        </div>
        <dl class="variablelist">
          <dt>Returns</dt>
          <dd>0 on success, -1 on failure.</dd>
        </dl>
        <div class="acl"/>
        <h3>
          <a name="virEventRegisterImpl">
            <code>virEventRegisterImpl</code>
          </a>
        </h3>
        <pre class="api"><span class="type">void</span>	virEventRegisterImpl		(<span class="type"><a href="libvirt-libvirt-event.html#virEventAddHandleFunc">virEventAddHandleFunc</a></span> addHandle,
					 <span class="type"><a href="libvirt-libvirt-event.html#virEventUpdateHandleFunc">virEventUpdateHandleFunc</a></span> updateHandle,
					 <span class="type"><a href="libvirt-libvirt-event.html#virEventRemoveHandleFunc">virEventRemoveHandleFunc</a></span> removeHandle,
					 <span class="type"><a href="libvirt-libvirt-event.html#virEventAddTimeoutFunc">virEventAddTimeoutFunc</a></span> addTimeout,
					 <span class="type"><a href="libvirt-libvirt-event.html#virEventUpdateTimeoutFunc">virEventUpdateTimeoutFunc</a></span> updateTimeout,
					 <span class="type"><a href="libvirt-libvirt-event.html#virEventRemoveTimeoutFunc">virEventRemoveTimeoutFunc</a></span> removeTimeout)</pre>
        <div class="description">
          <p>Registers an event implementation, to allow integration with an external event loop. Applications would use this to integrate with the libglib2 event loop, or libevent or the QT event loop.</p>
          <p>For proper event handling, it is important that the event implementation is registered before a connection to the Hypervisor is opened.</p>
          <p>Use of the <a href="libvirt-libvirt-event.html#virEventAddHandle">virEventAddHandle</a>() and similar APIs require that the corresponding handler is registered. Use of the <a href="libvirt-libvirt-domain.html#virConnectDomainEventRegisterAny">virConnectDomainEventRegisterAny</a>() and similar APIs requires that the three timeout handlers are registered. Likewise, the three timeout handlers must be registered if the remote server has been configured to send keepalive messages, or if the client intends to call <a href="libvirt-libvirt-host.html#virConnectSetKeepAlive">virConnectSetKeepAlive</a>(), to avoid either side from unexpectedly closing the connection due to inactivity.</p>
          <p>If an application does not need to integrate with an existing event loop implementation, then the <a href="libvirt-libvirt-event.html#virEventRegisterDefaultImpl">virEventRegisterDefaultImpl</a>() method can be used to setup the generic libvirt implementation.</p>
          <p>Once registered, the event loop implementation cannot be changed, and must be run continuously. Note that callbacks may remain registered for a short time even after calling <a href="libvirt-libvirt-host.html#virConnectClose">virConnectClose</a> on all open connections, so it is not safe to stop running the event loop immediately after closing the connection.</p>
        </div>
        <dl class="variablelist">
          <dt>addHandle</dt>
          <dd>the callback to add fd handles</dd>
          <dt>updateHandle</dt>
          <dd>the callback to update fd handles</dd>
          <dt>removeHandle</dt>
          <dd>the callback to remove fd handles</dd>
          <dt>addTimeout</dt>
          <dd>the callback to add a timeout</dd>
          <dt>updateTimeout</dt>
          <dd>the callback to update a timeout</dd>
          <dt>removeTimeout</dt>
          <dd>the callback to remove a timeout</dd>
        </dl>
        <div class="acl"/>
        <h3>
          <a name="virEventRemoveHandle">
            <code>virEventRemoveHandle</code>
          </a>
        </h3>
        <pre class="api"><span class="type">int</span>	virEventRemoveHandle		(<span class="type">int</span> watch)</pre>
        <div class="description">
          <p>Unregister a callback from a file handle. This function requires that an event loop has previously been registered with <a href="libvirt-libvirt-event.html#virEventRegisterImpl">virEventRegisterImpl</a>() or <a href="libvirt-libvirt-event.html#virEventRegisterDefaultImpl">virEventRegisterDefaultImpl</a>().</p>
        </div>
        <dl class="variablelist">
          <dt>watch</dt>
          <dd>watch whose file handle to remove</dd>
          <dt>Returns</dt>
          <dd>-1 if the file handle was not registered, 0 upon success.</dd>
        </dl>
        <div class="acl"/>
        <h3>
          <a name="virEventRemoveHandleFunc">
            <code>virEventRemoveHandleFunc</code>
          </a>
        </h3>
        <pre class="api"><span class="keyword">typedef</span> <span class="type">int</span>	(*virEventRemoveHandleFunc)	(<span class="type">int</span> watch)
</pre>
        <div class="description">
          <p>Part of the EventImpl, this user-provided callback is notified when an fd is no longer being listened on.</p>
          <p>If a virEventHandleFreeFunc was supplied when the handle was registered, it will be invoked some time during, or after this function call, when it is safe to release the user data.</p>
        </div>
        <dl class="variablelist">
          <dt>watch</dt>
          <dd>file descriptor watch to stop listening on</dd>
          <dt>Returns</dt>
          <dd>-1 if the file handle was not registered, 0 upon success</dd>
        </dl>
        <br/>
        <h3>
          <a name="virEventRemoveTimeout">
            <code>virEventRemoveTimeout</code>
          </a>
        </h3>
        <pre class="api"><span class="type">int</span>	virEventRemoveTimeout		(<span class="type">int</span> timer)</pre>
        <div class="description">
          <p>Unregister a callback for a timer. This function requires that an event loop has previously been registered with <a href="libvirt-libvirt-event.html#virEventRegisterImpl">virEventRegisterImpl</a>() or <a href="libvirt-libvirt-event.html#virEventRegisterDefaultImpl">virEventRegisterDefaultImpl</a>().</p>
        </div>
        <dl class="variablelist">
          <dt>timer</dt>
          <dd>the timer id to remove</dd>
          <dt>Returns</dt>
          <dd>-1 if the timer was not registered, 0 upon success.</dd>
        </dl>
        <div class="acl"/>
        <h3>
          <a name="virEventRemoveTimeoutFunc">
            <code>virEventRemoveTimeoutFunc</code>
          </a>
        </h3>
        <pre class="api"><span class="keyword">typedef</span> <span class="type">int</span>	(*virEventRemoveTimeoutFunc)	(<span class="type">int</span> timer)
</pre>
        <div class="description">
          <p>Part of the EventImpl, this user-defined callback removes a timer</p>
          <p>If a virEventTimeoutFreeFunc was supplied when the handle was registered, it will be invoked some time during, or after this function call, when it is safe to release the user data.</p>
        </div>
        <dl class="variablelist">
          <dt>timer</dt>
          <dd>the timer to remove</dd>
          <dt>Returns</dt>
          <dd>0 on success, -1 on failure</dd>
        </dl>
        <br/>
        <h3>
          <a name="virEventRunDefaultImpl">
            <code>virEventRunDefaultImpl</code>
          </a>
        </h3>
        <pre class="api"><span class="type">int</span>	virEventRunDefaultImpl		(<span class="type">void</span>)</pre>
        <div class="description">
          <p>Run one iteration of the event loop. Applications will generally want to have a thread which invokes this method in an infinite loop. Furthermore, it is wise to set up a pipe-to-self handler (via <a href="libvirt-libvirt-event.html#virEventAddHandle">virEventAddHandle</a>()) or a timeout (via <a href="libvirt-libvirt-event.html#virEventAddTimeout">virEventAddTimeout</a>()) before calling this function, as it will block forever if there are no registered events.</p>
          <pre class="code">static bool quit;

while (!quit) {
  if (virEventRunDefaultImpl() &lt; 0)
    ...print error...
}</pre>
        </div>
        <dl class="variablelist">
          <dt>Returns</dt>
          <dd>0 on success, -1 on failure.</dd>
        </dl>
        <div class="acl"/>
        <h3>
          <a name="virEventTimeoutCallback">
            <code>virEventTimeoutCallback</code>
          </a>
        </h3>
        <pre class="api"><span class="keyword">typedef</span> <span class="type">void</span>	(*virEventTimeoutCallback	)	(<span class="type">int</span> timer,
					 <span class="type">void *</span> opaque)
</pre>
        <div class="description">
          <p>callback for receiving timer events</p>
        </div>
        <dl class="variablelist">
          <dt>timer</dt>
          <dd>timer id emitting the event</dd>
          <dt>opaque</dt>
          <dd>user data registered with handle</dd>
        </dl>
        <br/>
        <h3>
          <a name="virEventUpdateHandle">
            <code>virEventUpdateHandle</code>
          </a>
        </h3>
        <pre class="api"><span class="type">void</span>	virEventUpdateHandle		(<span class="type">int</span> watch,
					 <span class="type">int</span> events)</pre>
        <div class="description">
          <p>Change event set for a monitored file handle. This function requires that an event loop has previously been registered with <a href="libvirt-libvirt-event.html#virEventRegisterImpl">virEventRegisterImpl</a>() or <a href="libvirt-libvirt-event.html#virEventRegisterDefaultImpl">virEventRegisterDefaultImpl</a>().</p>
          <p>Will not fail if fd exists.</p>
        </div>
        <dl class="variablelist">
          <dt>watch</dt>
          <dd>watch whose file handle to update</dd>
          <dt>events</dt>
          <dd>bitset of events to watch from <a href="libvirt-libvirt-event.html#virEventHandleType">virEventHandleType</a> constants</dd>
        </dl>
        <div class="acl"/>
        <h3>
          <a name="virEventUpdateHandleFunc">
            <code>virEventUpdateHandleFunc</code>
          </a>
        </h3>
        <pre class="api"><span class="keyword">typedef</span> <span class="type">void</span>	(*virEventUpdateHandleFunc)	(<span class="type">int</span> watch,
					 <span class="type">int</span> event)
</pre>
        <div class="description">
          <p>Part of the EventImpl, this user-provided callback is notified when events to listen on change</p>
        </div>
        <dl class="variablelist">
          <dt>watch</dt>
          <dd>file descriptor watch to modify</dd>
          <dt>event</dt>
          <dd>new events to listen on</dd>
        </dl>
        <br/>
        <h3>
          <a name="virEventUpdateTimeout">
            <code>virEventUpdateTimeout</code>
          </a>
        </h3>
        <pre class="api"><span class="type">void</span>	virEventUpdateTimeout		(<span class="type">int</span> timer,
					 <span class="type">int</span> timeout)</pre>
        <div class="description">
          <p>Change frequency for a timer. This function requires that an event loop has previously been registered with <a href="libvirt-libvirt-event.html#virEventRegisterImpl">virEventRegisterImpl</a>() or <a href="libvirt-libvirt-event.html#virEventRegisterDefaultImpl">virEventRegisterDefaultImpl</a>().</p>
          <p>Setting frequency to -1 will disable the timer. Setting the frequency to zero will cause it to fire on every event loop iteration.</p>
          <p>Will not fail if timer exists.</p>
        </div>
        <dl class="variablelist">
          <dt>timer</dt>
          <dd>timer id to change</dd>
          <dt>timeout</dt>
          <dd>time between events in milliseconds</dd>
        </dl>
        <div class="acl"/>
        <h3>
          <a name="virEventUpdateTimeoutFunc">
            <code>virEventUpdateTimeoutFunc</code>
          </a>
        </h3>
        <pre class="api"><span class="keyword">typedef</span> <span class="type">void</span>	(*virEventUpdateTimeoutFunc)	(<span class="type">int</span> timer,
					 <span class="type">int</span> timeout)
</pre>
        <div class="description">
          <p>Part of the EventImpl, this user-defined callback updates an event timeout.</p>
        </div>
        <dl class="variablelist">
          <dt>timer</dt>
          <dd>the timer to modify</dd>
          <dt>timeout</dt>
          <dd>the new timeout value</dd>
        </dl>
        <br/>
      </div>
    </div>
    <div id="nav">
      <div id="home">
        <a href="../index.html">Home</a>
      </div>
      <div id="jumplinks">
        <ul>
          <li>
            <a href="../downloads.html">Download</a>
          </li>
          <li>
            <a href="../contribute.html">Contribute</a>
          </li>
          <li>
            <a href="../docs.html">Docs</a>
          </li>
        </ul>
      </div>
      <div id="search">
        <form action="../search.php" enctype="application/x-www-form-urlencoded" method="get">
          <div>
            <input name="query" type="text" size="12" value=""/>
            <input name="submit" type="submit" value="Go"/>
          </div>
        </form>
      </div>
    </div>
    <div id="footer">
      <div id="contact">
        <h3>Contact</h3>
        <ul>
          <li>
            <a href="../contact.html#email">email</a>
          </li>
          <li>
            <a href="../contact.html#irc">irc</a>
          </li>
        </ul>
      </div>
      <div id="community">
        <h3>Community</h3>
        <ul>
          <li>
            <a href="https://twitter.com/hashtag/libvirt">twitter</a>
          </li>
          <li>
            <a href="https://plus.google.com/communities/109522598353007505282">google+</a>
          </li>
          <li>
            <a href="http://stackoverflow.com/questions/tagged/libvirt">stackoverflow</a>
          </li>
          <li>
            <a href="http://serverfault.com/questions/tagged/libvirt">serverfault</a>
          </li>
        </ul>
      </div>
      <div id="conduct">
            Participants in the libvirt project agree to abide by <a href="../governance.html#codeofconduct">the project code of conduct</a></div>
      <br class="clear"/>
    </div>
  </body>
</html>