[Scummvm-devel] Threading issues and mutexes :-)
Lionel Ulmer
lionel.ulmer at free.fr
Sun Jun 2 14:17:02 CEST 2002
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 :-)
Quick interface :
- OSystem::create_mutex : returns a void * being the handle to the mutex
- OSystem::lock_mutex : locks the given mutex
- OSystem::free_mutex : frees the given mutex
- OSystem::delete_mutex : deletes the given mutex
If nobody objects, I will start on this tomorrow evening (or the day after
depending of my free time :-) ).
Lionel
--
Lionel Ulmer - http://www.bbrox.org/
More information about the Scummvm-devel
mailing list