[Scummvm-devel] RE: [Scummvm-cvs-logs] CVS: scummvm/sound vorbis.cpp,1.12,1.13

Torbjorn.E.Andersson at tietoenator.com Torbjorn.E.Andersson at tietoenator.com
Sun Mar 21 10:28:00 CET 2004


Gaahhh! Wrong mailing list address again! I believe it not!

Max Horn <max at quendi.de> wrote:

> Hm, that's a serious problem then. The change you fixed in will cure 
> the symptoms in most cases, but there is still a possibility for 
> problems.
> 
> Essentially, if two threads (the sound thread and the main thread) 
> access the same file, it's possible that e.g. the sound thread seeks, 
> then the main thread gets its time slice, and also seeks/reads from the 
> file. Then when we are back in the sound thread, the problem is back.

The assumption I made when I made that change was that only the mixer
would trigger the reading of the sound file, and that this would ensure
that there were no thread issues. Which still left the issue of
pointing the file to the correct spot since the sounds shared a common
file handle, and they were being read one piece at a time.

But on second thought, at least FotAQ stores everything in one big file,
and I think it uses the same file handle for everything. So you may be
right about...

> The only way to fully resolve that would be to use a mutex there, I am 
> afraid... Maybe we should add lock()/unlock() methods to class File 
> <sigh>

...or would it be enough if the mixer could be given its own File handle
to use for streaming sounds from a file? I'm too tired to think about
that right now.

Torbjörn

-- 
TietoEnator Resource Management AB
Persona
Torbjörn Andersson
http://www.rm.tietoenator.com/
 




More information about the Scummvm-devel mailing list