While this really isn't a multi-threaded approach, it might give the same flexibility in that while your updating the screen, just let the main event loop run until you're images are loaded, the loop could still process messages, but doesn't need to evtWaitForever. Then in each iteration of the loop, download and render as much of the image each time as you can without interrupting the rest of processing. Maybe something like this

UInt8 imagesLoaded = 0;

do {

 EvtGetEvent(&event,imagesLoaded);

 DrawMainScreen();

// You could probably render all the images or one at a time in each iteration if they are small

 Boolean imagesDone = RenderImages();

 if (imagesDone)
    imagesLoaded = evtWaitForever;

}while (evt->type != appStopEvent);


From: "Donald C. Kirker" <[EMAIL PROTECTED]>
Reply-To: "Palm Developer Forum" <[email protected]>
To: "Palm Developer Forum" <[email protected]>
Subject: Simple multithreading in OS 5
Date: Sun, 20 Aug 2006 02:26:03 -0000

Ok, so I searched this, and came up with many answers. Unfortunatly, they really don't answer my question.

Basically, I have an open source web browser. It downloads images after the page is processed. What I want to do is download the images and render them in a separate thread so that the user can still scroll the page and have 100% access to the stop button while this is happening.

I don't believe I use globals, but my code is in a few different segments, so I need multisegment access.

Are there any solutions? I tried the sound callback method, but because of the multi-segment requirement my program crashes when SndStreamStart is called.

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



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

Reply via email to