.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Sys::Virt::Event 3pm" .TH Sys::Virt::Event 3pm 2024-01-21 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Sys::Virt::Event \- Event loop access .SH DESCRIPTION .IX Header "DESCRIPTION" The \f(CW\*(C`Sys::Virt::Event\*(C'\fR module represents the contract for integrating libvirt with an event loop. This package is abstract and intended to be subclassed to provide an actual implementation. .SH "DEPRECATED FUNCTIONALITY" .IX Header "DEPRECATED FUNCTIONALITY" Event loop implementations used to be required to be instances of sub-classes of \f(CW\*(C`Sys::Virt::Event\*(C'\fR. Instead, they are now required to inherit from \f(CW\*(C`Sys::Virt::EventImpl\*(C'\fR. For backward compatibility with versions 9.4 and older, inheriting from \f(CW\*(C`Sys::Virt::Event\*(C'\fR is still supported, but will be removed mid 2025. .SH METHODS .IX Header "METHODS" .IP \fBregister_default()\fR 4 .IX Item "register_default()" Register the default libvirt event loop implementation .IP \fBrun_default()\fR 4 .IX Item "run_default()" Run a single iteration of the default event loop implementation .IP register($impl) 4 .IX Item "register($impl)" Register an event loop implementation. The implementation should be a instance of a sub-class of the \f(CW\*(C`Sys::Virt::EventImpl\*(C'\fR package. See the section "EVENT LOOP IMPLEMENTATION" below for more information. .ie n .IP "my $watch = Sys::Virt::Event::add_handle($fd, $events, $coderef)" 4 .el .IP "my \f(CW$watch\fR = Sys::Virt::Event::add_handle($fd, \f(CW$events\fR, \f(CW$coderef\fR)" 4 .IX Item "my $watch = Sys::Virt::Event::add_handle($fd, $events, $coderef)" Adds a watch on the file descriptor \f(CW$fd\fR for the events \f(CW$events\fR which is a mask of the FILE HANDLE EVENTS constants listed later. The \f(CW$coderef\fR parameter is a subroutine to invoke when an event is triggered. The subroutine will be passed three parameters, the watch identifier, the file descriptor and the event mask. This method returns the watch identifier which can be used to update or remove the watch .ie n .IP "Sys::Virt::Event::update_handle($watch, $events)" 4 .el .IP "Sys::Virt::Event::update_handle($watch, \f(CW$events\fR)" 4 .IX Item "Sys::Virt::Event::update_handle($watch, $events)" Update the event mask for the file descriptor watch \f(CW$watch\fR to use the events \f(CW$events\fR. .IP Sys::Virt::Event::remove_handle($watch) 4 .IX Item "Sys::Virt::Event::remove_handle($watch)" Remove the event mask for the file descriptor watch \f(CW$watch\fR. .ie n .IP "my $timer = Sys::Virt::Event::add_timeout($frequency, $coderef, $opaque)" 4 .el .IP "my \f(CW$timer\fR = Sys::Virt::Event::add_timeout($frequency, \f(CW$coderef\fR, \f(CW$opaque\fR)" 4 .IX Item "my $timer = Sys::Virt::Event::add_timeout($frequency, $coderef, $opaque)" Adds a timeout to trigger with \f(CW$frequency\fR milliseconds interval. The \f(CW$coderef\fR parameter is a subroutine to invoke when an event is triggered. The subroutine will be passed one parameter, the timer identifier. This method returns the timer identifier which can be used to update or remove the timer .ie n .IP "Sys::Virt::Event::update_timeout($timer, $frequency)" 4 .el .IP "Sys::Virt::Event::update_timeout($timer, \f(CW$frequency\fR)" 4 .IX Item "Sys::Virt::Event::update_timeout($timer, $frequency)" Update the timeout \f(CW$timer\fR to have the frequency \f(CW$frequency\fR milliseconds. The values \f(CW0\fR and \f(CW\-1\fR have special meaning. The value \f(CW0\fR wants the callback to be invoked on each event loop iteration, where \&\f(CW\-1\fR stops the callback from being invoked. .IP Sys::Virt::Event::remove_timeout($timer) 4 .IX Item "Sys::Virt::Event::remove_timeout($timer)" Remove the timeout \f(CW$timer\fR .SH CONSTANTS .IX Header "CONSTANTS" .SS "FILE HANDLE EVENTS" .IX Subsection "FILE HANDLE EVENTS" When integrating with an event loop the following constants define the file descriptor events .IP Sys::Virt::Event::HANDLE_READABLE 4 .IX Item "Sys::Virt::Event::HANDLE_READABLE" The file descriptor has data available for read without blocking .IP Sys::Virt::Event::HANDLE_WRITABLE 4 .IX Item "Sys::Virt::Event::HANDLE_WRITABLE" The file descriptor has ability to write data without blocking .IP Sys::Virt::Event::HANDLE_ERROR 4 .IX Item "Sys::Virt::Event::HANDLE_ERROR" An error occurred on the file descriptor .IP Sys::Virt::Event::HANDLE_HANGUP 4 .IX Item "Sys::Virt::Event::HANDLE_HANGUP" The remote end of the file descriptor closed .SH AUTHORS .IX Header "AUTHORS" Daniel P. Berrange .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright (C) 2006\-2009 Red Hat Copyright (C) 2006\-2009 Daniel P. Berrange .SH LICENSE .IX Header "LICENSE" This program is free software; you can redistribute it and/or modify it under the terms of either the GNU General Public License as published by the Free Software Foundation (either version 2 of the License, or at your option any later version), or, the Artistic License, as specified in the Perl README file. .SH "SEE ALSO" .IX Header "SEE ALSO" Sys::Virt, \f(CW\*(C`http://libvirt.org\*(C'\fR