[Scummvm-devel] Threading issues and mutexes :-)

Marcus Comstedt marcus at mc.pp.se
Sun Jun 2 15:02:03 CEST 2002


Lionel Ulmer <lionel.ulmer at free.fr> writes:

> Hi all,
> 
> My streaming patch does not fix yet all the problems that can be found
> between the main thread and the sound playing thread (mainly because there
> is no way I can see to differentiate a buffer underrun from a stream
> 'normally' finishing playing). The patch may even get worse results on some
> platforms :-/ (as in some cases, it will append stuff to a buffer that was
> already deleted by free).
> 
> The only way to fix this is to add some mutex capabilities in the OSystem
> interface (thus adding a mutex to all sound objects to be able to do
> operations on them being sure that the sound thread will not destroy it
> while we play with it :-) ).
> 
> So does everyone agree with it ? I ask here because I know how to do it in
> the X11 port, it should not be that hard to do in the SDL port (as SDL
> proposes mutex services), but I have no idea if other porters will find it
> difficult to do or not :-)

Probably wouldn't make any sense to implement mutexes in the Dreamcast
port since it doesn't implement threads.  Would it be possible to
somehow separate the MIDI code from the threads stuff so it is
possible to use it with another process model than threads?  On the
Dreamcast it would make the most sense to run it on the sound CPU,
which has its own address space and instrucion set, meaning no shared
variables or object files with the rest of the code...


  // Marcus






More information about the Scummvm-devel mailing list