[SDL] What are threads allowed to do?
stephane.marchesin at wanadoo.fr
Sun Jan 23 09:05:20 PST 2005
Albert Cahalan wrote:
>>>I tried using threads, hit memory corruption problems, and...
>>Well, show us a small program demonstrating memory corruption with SDL
>>threads, and we'll have a chance to find the reason for this problem.
>That's a tough order to fill I think.
>I saw the problem in Tux Paint, which is one 15469-line file.
>(yes, yes, we know -- it grew over time)
We usually ask this because it works.
That said, if you happen to have a test case demonstrating a precise
problem, don't hesitate.
>One thread was using libSDL_ttf. It scanned through about 200
>font files. The thread would open a file, render some test text,
>and close the file.
>Meanwhile, the main app thread was mostly loading PNG images.
>It would load a few hundred perhaps, along with a couple fonts
>and perhaps dozens of *.wav files. The main thread has video
>and sound going.
I quickly looked at the file and I think you'll really have a hard time
getting it to work, there are too many global variables, whereas I
couldn't spot any mutex. Threaded programming must be thought about at
I use SDL threads for high performance duties (parallel visualization,
we're talking about 10s of threads here) and I never had any problems
So I definitely think threads (be it SDL or posix theads) are neither
useless nor buggy.
More information about the SDL