<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Hi Joseph,<br>
<br>
<br>
Cannot comment much on first item, but can provide info on IEvent,
as designed it.<br>
Generally, look at vboxshell.py which using events in passive mode,
to see working usecase. Especially monitorGuestKbd/monitorGuestMouse<br>
or even more powerful recordDemo/playbackDemo will show you how it's
designed to be used.<br>
<br>
08.12.2010 5:03, Joseph Smith пишет:
<blockquote cite="mid:442500.9641.qm@web63402.mail.re1.yahoo.com"
type="cite">
<style type="text/css"><!-- DIV {margin:0px;} --></style>
<div style="font-family: 'times new roman','new york',times,serif;
font-size: 12pt;"><br>
<div><br>
</div>
<div>2) The IEvent enhancements</div>
<div>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.</div>
<div><br>
</div>
<div>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.</div>
</div>
</blockquote>
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<br>
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.<br>
<br>
<blockquote cite="mid:442500.9641.qm@web63402.mail.re1.yahoo.com"
type="cite">
<div style="font-family: 'times new roman','new york',times,serif;
font-size: 12pt;">
<div><br>
</div>
<div>The documentation states IEventListener::HandleEvent could
be called in passive mode. The documentation however is
unclear on what IEventListner::handleEvent does in passive
mode.</div>
<div><br>
</div>
</div>
</blockquote>
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<br>
once event is available - pretty much a callback.<br>
<br>
<br>
<blockquote cite="mid:442500.9641.qm@web63402.mail.re1.yahoo.com"
type="cite">
<div style="font-family: 'times new roman','new york',times,serif;
font-size: 12pt;">Does making this call eventually cause
IEvent::SetProcessed function to be called? <br>
</div>
</blockquote>
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).<br>
<br>
<blockquote cite="mid:442500.9641.qm@web63402.mail.re1.yahoo.com"
type="cite">
<div style="font-family: 'times new roman','new york',times,serif;
font-size: 12pt;">
<div>Are there limitations to how quickly
the IEventSource::GetEvent function can be called?</div>
</div>
</blockquote>
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 <br>
windowing toolkit this is smth like an event getter you call in your
event loop. Pseudo-code is like<br>
while (true)<br>
{<br>
IEvent ev = source.getEvent(listener, 1000);<br>
if (ev == null)<br>
continue;<br>
<br>
processEvent(ev);<br>
if (fExitCondition)<br>
break;<br>
}<br>
<br>
<br>
Thanks,<br>
Nikolay <br>
</body>
</html>