[vbox-dev] VBox 4.0 and IMachine::AttachDevice API

Nikolay Igotti nikolay.igotti at oracle.com
Wed Dec 8 08:15:02 GMT 2010


    Hi Joseph,


  Cannot comment much on first item, but can provide info on IEvent, as 
designed it.
Generally, look at vboxshell.py which using events in passive mode, to 
see working usecase. Especially monitorGuestKbd/monitorGuestMouse
or even more powerful recordDemo/playbackDemo will show you how it's 
designed to be used.

08.12.2010 5:03, Joseph Smith ?????:
>
>
> 2) The IEvent enhancements
> I am using webservice APIs.  From the documentation, the IEvent 
> enhancements for 4.0 appear to provide an excellent way to allow 
> passive interfaces to be aware of changes using 
> IEventSource::RegisterListener.
>
> From the documentation, we are told that the passive listener would 
> periodically call IEventSource::GetEvent to determine if there is a 
> pending event notification that must be consumed.  It then seems once 
> the client has completed processing the event, the 
> IEventSource::EventProcessed function will be called internally.
No, this is not the case for passive listeners.  For passive listeners 
and waitable events IEventSource::EventProcessed must be called by 
consumer of events, once event's internal
state is updated. This way whoever fires an event can wait till that 
moment, if it needs information from event's internal state updated by 
event processor.

>
> The documentation states IEventListener::HandleEvent could be called 
> in passive mode.  The documentation however is unclear on what 
> IEventListner::handleEvent does in passive mode.
>
I think here documentation is misleading - will fix it. Generally, for 
listener registered as passive calling this method is an error. For 
active listener this is code called
once event is available - pretty much a callback.


> Does making this call eventually cause IEvent::SetProcessed  function 
> to be called?
If all listeners for event are active, IEvent::SetProcessed() indeed 
called automatically, otherwise it is called once all passive listeners 
called IEventSource::EventProcessed().You can skip calling 
EventProcessed() if you know that all events you're registered for 
aren't waitable (see IEvent::waitable).

> Are there limitations to how quickly the IEventSource::GetEvent 
> function can be called?
As this is blocking call (at least in most cases it better be used as 
such, with timeout != 0), it doesn't make sense to do this call very 
frequently. If you're familiar with any
windowing toolkit this is smth like an event getter you call in your 
event loop.  Pseudo-code is like
while (true)
{
    IEvent ev = source.getEvent(listener, 1000);
    if (ev == null)
         continue;

     processEvent(ev);
     if (fExitCondition)
            break;
  }


  Thanks,
     Nikolay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20101208/3c49814b/attachment.html>


More information about the vbox-dev mailing list