[vbox-dev] Passive event handling
Nikolay Igotti
igotti at gmail.com
Mon Oct 1 09:09:04 PDT 2012
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 list
> vbox-dev at virtualbox.org
> https://www.virtualbox.org/mailman/listinfo/vbox-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.virtualbox.org/pipermail/vbox-dev/attachments/20121001/12df137d/attachment-0002.html
More information about the vbox-dev
mailing list