Hi Regis,
there is really no problem with the sleep or doze mode and the processor is
not unnecessarily overloaded - this is achieved with other means. I am just
trying to find the most efficient way of event checking while being
- in the middle of a long processor-intensive loop, or
- just waiting for some trigger. (Here the unnecessary delays are to be
avoided.)
I experimentally found that under special circumstances the logical sequence
if( IsEvtAvailable())
EvtGetEvent(&event, some timeout > 0);
fails (i.e. event is not available and an unnecessary delay is introduced).
This could cause an important delay in my original code which I wanted to
avoid.
Another logical solution would be calling EvtGetEvent(&event, 0) directly
without preliminary check on IsEvtAvailable(). This works reliably, but it
appears to be rather expensive solution.
So finally I decided to use
if( IsEvtAvailable())
{
EvtGetEvent(&event, 0);
// check on nilEvent !!! - this corrects for isEvtAvailable failure
}
This appears to be fast enough and EvtGetEvent won't block the computation
even if IsEvtAvailable reports a wrong answer.
Regards,
Jan Slodicka
----- Original Message -----
From: "Regis St-Gelais" <[EMAIL PROTECTED]>
Newsgroups: palm-dev-forum
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Friday, April 09, 2004 2:19 AM
Subject: Re: EvtEventAvail unreliable?!
> Actualy, the real term is: "doze mode", not "sleep mode"
>
> From the companion documentation:
> <quote>
> In doze mode, the main clock is running, the handheld
> appears to be turned on, the LCD is on, and the processor's
> clock is running but it's not executing instructions (that is, it's
> halted). When the processor receives an interrupt, it comes
> out of halt and starts processing the interrupt.
> The handheld enters this mode whenever it's on but has no
> user input to process.
> The system can come out of doze mode much faster than it
> can come out of sleep mode since none of the peripherals
> need to be woken up. In fact, it takes no longer to come out of
> doze mode than to process an interrupt. Usually, when the
> system appears on, it is actually in doze mode and goes into
> running mode only for short periods of time to process an
> interrupt or respond to user input like a pen tap or key press.
> </quote>
> --
> Regis St-Gelais
> www.laubrass.com
> --
> "Regis St-Gelais" <[EMAIL PROTECTED]> a �crit dans le message
de
> news:[EMAIL PROTECTED]
> > The device fall into sleep while it is waiting for an event inside the
> > EvtGetEvent. If the timeout is at 0 it never fall into sleep mode.
> >
> > --
> > Regis St-Gelais
> > www.laubrass.com
> > --
> > "Jan Slodicka" <[EMAIL PROTECTED]> a �crit dans le message de
> > news:[EMAIL PROTECTED]
> > > That's not true. Test on nilEvent will prevent that.
> > >
> > > Jan Slodicka
> > >
> > > ----- Original Message -----
> > > From: "Regis St-Gelais" <[EMAIL PROTECTED]>
> > > Newsgroups: palm-dev-forum
> > > To: "Palm Developer Forum" <[EMAIL PROTECTED]>
> > > Sent: Thursday, April 08, 2004 3:37 PM
> > > Subject: Re: EvtEventAvail unreliable?!
> > >
> > >
> > > >
> > > >
> > > > "Jan Slodicka" <[EMAIL PROTECTED]> a �crit dans le message de
> > > > news:[EMAIL PROTECTED]
> > > >
> > > > <snip>
> > > > > 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.)
> > > > >
> > > > <snip>
> > > >
> > > > This loop will reduce the battery life as the device will never go
to
> > > sleep
> > > > between events.
> > > >
> > > > --
> > > > Regis St-Gelais
> > > > www.laubrass.com
> > > > --
> > > >
> > > >
> > > >
> > > > --
> > > > 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/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/