I posted this earlier, but for some reason it didn't seem to get posted:
-----------------
I've noticed this when you do a hard reset.  The "Erase all data?  YES - up
button" screen" drives my system to a crawl.

I'm sure it's just a poorly written tight loop in the emulator.
If you write a windows program like this

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
while (true)
    NULL;
 return 0;
}
All your CPU cycles will be eaten up.

A well written app will not do anything if it has nothing in the queue, like
this

while (GetMessage(&msg, NULL, 0, 0))
 {
 }
GetMessage doesn't return unless there is a relavent message, so it lets the
system do its thing when the app is idle.

In some cases the emulator appears to just do a tight loop.
--------

Anyway, I did a little testing and discovered i was not quite right anyway.
It's not the emulator, its your program.
If you do a tight loop in a Palm program on the emulator (or otherwise do a
lot of stuff without quitting and letting the Palm OS event handler do its
thing), the emulator will, of course suck up all available CPU cycles.  This
is what you would want it to do if you are doing heavy computation.  If you
are just idle, don't do an idle loop, just return from your event handler
and wait for the Palm OS to pass you your next event.  I'm sure there's a
good technical reason why the Palm OS's "Erase All Data" is doing a loop
that constantly checks for a key down (which sucks up all cpu cycles) rather
than a blocking call (which would do nothing at all until a key down event
was received).


"Dan Patrutiu" <[EMAIL PROTECTED]> wrote in message
news:111218@palm-dev-forum...
>
>     When I run the Emulator and the Launcher window is shown, all things
are
> normal, the processor time taken by the Emulator is non-semnificative. But
> when I run some programs, including the one I develop, the System Idle
> process has 0 percents of the processor time, and the Emulator 99
percents.
> This is not happening to all the programs, and I am very curious just to
> know the reason for this. ( maybe the Emulator is having some problems and
> is cycling up all the time )
>
>
>
>



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

Reply via email to