>
> EvtEventAvail is, perhaps, an unfortunate name for that particular
> function, but it's easily worked around by not calling it at all,
> and instead calling EvtGetEvent with an appropriate timeout.

Apparently you are right

One of the typical sequencies we often used was:

while( EvtEventAvail() )
{
  EvtGetEvent(&event, 1);
  if( event.eType != nilEvent )
    // do something...
}

Perhaps this should be replaced by

while( true )
{
    EvtGetEvent(&event, 0);
    if( event.eType == nilEvent )
        break ;
    // do something...
}

Seems to be smaller and safer code. (By "safer" I mean that it does not
introduce unnecessary delays in the situations when they are to be avoided.)

With best regards,
    Jan Slodicka


----- Original Message -----
From: "Blake Winton" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Wednesday, April 07, 2004 10:59 PM
Subject: RE: EvtEventAvail unreliable?!


> > > if( EvtEventAvail() )
> > > {
> > >     EventType event ;
> > >     EvtGetEvent( &event, SysTicksPerSecond() );
> > >     // Returns nil event after 1 second delay
> > > }
> > Can I ask why you are passing SysTicksPerSecond() as an argument for
> > EvtGetEvent?
>
> I think you're missing the bigger picture, Tim, which is to say,
> "Why, if there's an event available, would EvtGetEvent wait at all?"
>
> And the answer, as I understand it, is that sometimes there is an
> event available, but the OS steals it as part of its EvtGetEvent
> processing, and so it's not available to you.
>
> EvtEventAvail is, perhaps, an unfortunate name for that particular
> function, but it's easily worked around by not calling it at all,
> and instead calling EvtGetEvent with an appropriate timeout.
>
> Later,
> Blake.
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to