1Sys::Virt::Event(3) User Contributed Perl Documentation Sys::Virt::Event(3)
2
3
4
6 Sys::Virt::Event - An event loop contract
7
9 The "Sys::Virt::Event" module represents the contract for integrating
10 libvirt with an event loop. This package is abstract and intended to be
11 subclassed to provide an actual implementation.
12
14 register_default()
15 Register the default libvirt event loop implementation
16
17 run_default()
18 Run a single iteration of the default event loop implementation
19
20 register($impl)
21 Register an event loop implementation. The implementation should be
22 a instance of a sub-class of the "Sys::Virt::Event" package.
23
24 $self->_run_handle_callback($watch, $fd, $events, $cb, $opaque)
25 A helper method for executing a callback in response to one of more
26 $events on the file handle $fd. The $watch number is the unique
27 idenifier associated with the file descriptor. The $cb and $opaque
28 parameters are the callback and data registered for the handle.
29
30 $self->_run_timeout_callback($timer, $cb, $opaque)
31 A helper method for executing a callback in response to the expiry
32 of a timeout identified by $timer. The $cb and $opaque parameters
33 are the callback and data registered for the timeout.
34
35 $self->_free_callback_opaque($ff, $opaque)
36 A helper method for freeing the data associated with a callback.
37 The $ff and $opaque parameters are the callback and data registered
38 for the handle/timeout.
39
40 my $watch = Sys::Virt::Event::add_handle($fd, $events, $coderef)
41 Adds a watch on the file descriptor $fd for the events $events
42 which is a mask of the FILE HANDLE EVENTS constants listed later.
43 The $coderef parameter is a subroutine to invoke when an event is
44 triggered. The subroutine will be passed three parameters, the
45 watch identifier, the file descriptor and the event mask. This
46 method returns the watch identifier which can be used to update or
47 remove the watch
48
49 Sys::Virt::Event::update_handle($watch, $events)
50 Update the event mask for the file descriptor watch $watch to use
51 the events $events.
52
53 Sys::Virt::Event::remove_handle($watch)
54 Remove the event mask for the file descriptor watch $watch.
55
56 my $watch = Sys::Virt::Event::add_timeout($frequency, $coderef)
57 Adds a timeout to trigger with $frequency milliseconds interval.
58 The $coderef parameter is a subroutine to invoke when an event is
59 triggered. The subroutine will be passed one parameter, the timer
60 identifier. This method returns the watch identifier which can be
61 used to update or remove the watch
62
63 Sys::Virt::Event::update_timeout($timer, $frequency)
64 Update the timeout $timer to have the frequency $frequency
65 milliseconds.
66
67 Sys::Virt::Event::remove_timeout($timer)
68 Remove the timeout $timer
69
71 FILE HANDLE EVENTS
72 When integrating with an event loop the following constants define the
73 file descriptor events
74
75 Sys::Virt::Event::HANDLE_READABLE
76 The file descriptor has data available for read without blocking
77
78 Sys::Virt::Event::HANDLE_WRITABLE
79 The file descriptor has ability to write data without blocking
80
81 Sys::Virt::Event::HANDLE_ERROR
82 An error occurred on the file descriptor
83
84 Sys::Virt::Event::HANDLE_HANGUP
85 The remote end of the file descriptor closed
86
88 Daniel P. Berrange <berrange@redhat.com>
89
91 Copyright (C) 2006-2009 Red Hat Copyright (C) 2006-2009 Daniel P.
92 Berrange
93
95 This program is free software; you can redistribute it and/or modify it
96 under the terms of either the GNU General Public License as published
97 by the Free Software Foundation (either version 2 of the License, or at
98 your option any later version), or, the Artistic License, as specified
99 in the Perl README file.
100
102 Sys::Virt, "http://libvirt.org"
103
104
105
106perl v5.30.1 2020-03-10 Sys::Virt::Event(3)