[vbox-dev] Passive event handling

Ian Moore imooreyahoo at gmail.com
Mon Oct 8 14:29:47 GMT 2012


Thank you for your help guys. I've got it sorted out.

On Mon, Oct 1, 2012 at 12:09 PM, Nikolay Igotti <igotti at gmail.com> wrote:

>      Hi Ian,
>
>  Think your question is mostly about locking, and my understanding is that
> there's no need
> to lock the VM. Genereally, as Klaus pointed out, event source holds
> reference to object which
> produces events for it, shall it be Console, Machine or VirtualBox
> instance.
>  So your code could be significantly simplified.
> vboxshell.py contains reasonable (for the moment I wrote it) usecase of
> event sources, including
> filtering and aggregation.
>
>
>  Thanks,
>      Nikolay
>
>
> On 10/01/2012 04:58 PM, Ian Moore wrote:
>
> Hello,
>
> I'm having some trouble following the passive event mechanism logic. I'm
> working on a web application and it will periodically poll vboxwebsrv for
> events. While this works well with the vbox event source, I'm not quite
> sure how to implement this for individual machine console events. Should it
> go like this:
>
> 1. Create an event listener when a running machine is selected
> --- machine = vbox->findMachine(...)
> --- session = websessionManager->getSessionObject()
> --- listener = session->console->eventSource->createListener()
> --- session->console->eventSource->registerListener(listener,...,false)
> --- session->unlock(machine)
>
> 2. Then periodically poll for events. Each poll cycle would
> --- machine = vbox->findMachine(...)
> --- session = websessionManager->getSessionObject()
> --- while(event = session->console->eventSource->getEvent(listener created
> in step #1)) { ... }
> --- session->unlock(machine)
>
> Should I leave the shared lock in place (leaving session->console
> available) until the machine is deselected or stopped? I tried looking
> through the VirtualBox source, but was unable to determine how it should
> work.
>
> Thank you for any help!
>
>
> _______________________________________________
> vbox-dev mailing listvbox-dev at virtualbox.orghttps://www.virtualbox.org/mailman/listinfo/vbox-dev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20121008/d6e5f49b/attachment.html>


More information about the vbox-dev mailing list