[SDL] Some confusion over thread limitations

Bob Pendleton bob at pendleton.com
Wed Nov 19 06:46:01 PST 2003

On Mon, 2003-11-17 at 15:45, Robert Sadedin wrote:
> I've been attempting to make a loading screen for my game which shows a
> progression bar.
> The theory was that a main loop would display the progress bar while a
> thread loads images until all are done.  I assume I mis-interpreted the docs
> on threading in that I believed so long as I didn't do any blitting my
> thread could load images and have them accessed from the main SDL thread.
> This appears wrong (although I'd love to be proven wrong).

We need more information before we can answer you question. What exactly
do you mean by loading images? Are you just reading them into memory or
are you trying to make them into textures at the same time? What exactly
are the steps you are following? 

Why don't you think it works? There is no good reason why you can't have
a thread read a file into RAM while the main loop is doing graphics on
the screen. It is possible that they main loop, if written incorrectly,
is taking up all the CPU time and the thread is never running. 

> If this is the case, is there an appropriate method I can use to load my
> data and show a progression bar at the same time?

To do it in a thread you had to have a way for the thread that reads the
data to tell the progress bar to advance, right? So, instead of changing
a global variable or what ever you are doing to post the progress, just
update the progress bar directly.

		Bob Pendleton

> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
+ Bob Pendleton: writer and programmer. +
+ email: Bob at Pendleton.com              +
+ web:   www.GameProgrammer.com         +

More information about the SDL mailing list