1Sys::Virt::Event(3pm) User Contributed Perl DocumentationSys::Virt::Event(3pm)
2
3
4

NAME

6       Sys::Virt::Event - Event loop access
7

DESCRIPTION

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

DEPRECATED FUNCTIONALITY

14       Event loop implementations used to be required to be instances of sub-
15       classes of "Sys::Virt::Event". Instead, they are now required to
16       inherit from "Sys::Virt::EventImpl". For backward compatibility with
17       versions 9.4 and older, inheriting from "Sys::Virt::Event" is still
18       supported, but will be removed mid 2025.
19

METHODS

21       register_default()
22           Register the default libvirt event loop implementation
23
24       run_default()
25           Run a single iteration of the default event loop implementation
26
27       register($impl)
28           Register an event loop implementation. The implementation should be
29           a instance of a sub-class of the "Sys::Virt::EventImpl" package.
30           See the section "EVENT LOOP IMPLEMENTATION" below for more
31           information.
32
33       my $watch = Sys::Virt::Event::add_handle($fd, $events, $coderef)
34           Adds a watch on the file descriptor $fd for the events $events
35           which is a mask of the FILE HANDLE EVENTS constants listed later.
36           The $coderef parameter is a subroutine to invoke when an event is
37           triggered. The subroutine will be passed three parameters, the
38           watch identifier, the file descriptor and the event mask. This
39           method returns the watch identifier which can be used to update or
40           remove the watch
41
42       Sys::Virt::Event::update_handle($watch, $events)
43           Update the event mask for the file descriptor watch $watch to use
44           the events $events.
45
46       Sys::Virt::Event::remove_handle($watch)
47           Remove the event mask for the file descriptor watch $watch.
48
49       my $timer = Sys::Virt::Event::add_timeout($frequency, $coderef,
50       $opaque)
51           Adds a timeout to trigger with $frequency milliseconds interval.
52           The $coderef parameter is a subroutine to invoke when an event is
53           triggered. The subroutine will be passed one parameter, the timer
54           identifier. This method returns the timer identifier which can be
55           used to update or remove the timer
56
57       Sys::Virt::Event::update_timeout($timer, $frequency)
58           Update the timeout $timer to have the frequency $frequency
59           milliseconds. The values 0 and -1 have special meaning. The value 0
60           wants the callback to be invoked on each event loop iteration,
61           where -1 stops the callback from being invoked.
62
63       Sys::Virt::Event::remove_timeout($timer)
64           Remove the timeout $timer
65

CONSTANTS

67   FILE HANDLE EVENTS
68       When integrating with an event loop the following constants define the
69       file descriptor events
70
71       Sys::Virt::Event::HANDLE_READABLE
72           The file descriptor has data available for read without blocking
73
74       Sys::Virt::Event::HANDLE_WRITABLE
75           The file descriptor has ability to write data without blocking
76
77       Sys::Virt::Event::HANDLE_ERROR
78           An error occurred on the file descriptor
79
80       Sys::Virt::Event::HANDLE_HANGUP
81           The remote end of the file descriptor closed
82

AUTHORS

84       Daniel P. Berrange <berrange@redhat.com>
85
87       Copyright (C) 2006-2009 Red Hat Copyright (C) 2006-2009 Daniel P.
88       Berrange
89

LICENSE

91       This program is free software; you can redistribute it and/or modify it
92       under the terms of either the GNU General Public License as published
93       by the Free Software Foundation (either version 2 of the License, or at
94       your option any later version), or, the Artistic License, as specified
95       in the Perl README file.
96

SEE ALSO

98       Sys::Virt,  "http://libvirt.org"
99
100
101
102perl v5.38.0                      2023-09-08             Sys::Virt::Event(3pm)
Impressum