Sys::Virt integration into other event loops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I’m trying to integrate Perl’s Sys::Virt into an already existing AnyEvent program.

I’m accustomed to writing things like this:

use EV;
use AnyEvent;
use AnyEvent::Handle;
my $h = AnyEvent::Handle->new(fh => $fh, …);
$h->on_read(sub { … });

EV::run;  ## start the event loop

I can add some code in the on_read() handler and every time the $fh has something to read, it will fire off. I’d like to do something similar with Sys::Virt, but I can’t seem to wrap my head around its event system. The only examples I can find are the ones included in Sys::Virt source, which consist of a series of run_once() calls, or a while loop around run_default().

Does anyone have any idea how I can make this play nicely with an existing event loop such as EV, or even to fire off ($cv->send) an AnyEvent condvar when the event I set in domain_event_register_any() triggers?

Our current solution involves setting an AnyEvent->timer, which periodically fires off and then does a run_once() to see if any events happened during the period, but we’d like something more responsive (i.e., triggers when the event actually occurs) and less poll-y feeling.

I’d appreciate any advice you may have—thanks!

Scott

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users

[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux