AUDIO: Added mutex() method to return the mixer's internal mutex.
This is so that individual audio players can share the same mutex as the mixer. When they have their own, it's apparently quite easy to accidentally introduce deadlocks. Particularly when the audio player is shut down.
This commit is contained in:
parent
745f912ca1
commit
1bd7028c31
2 changed files with 7 additions and 0 deletions
|
@ -23,6 +23,7 @@
|
|||
#ifndef AUDIO_MIXER_H
|
||||
#define AUDIO_MIXER_H
|
||||
|
||||
#include "common/mutex.h"
|
||||
#include "common/types.h"
|
||||
#include "common/noncopyable.h"
|
||||
|
||||
|
@ -94,6 +95,10 @@ public:
|
|||
*/
|
||||
virtual bool isReady() const = 0;
|
||||
|
||||
/**
|
||||
* Return the mixer's internal mutex so that audio players can use it.
|
||||
*/
|
||||
virtual Common::Mutex &mutex() = 0;
|
||||
|
||||
/**
|
||||
* Start playing the given audio stream.
|
||||
|
|
|
@ -86,6 +86,8 @@ public:
|
|||
|
||||
virtual bool isReady() const { Common::StackLock lock(_mutex); return _mixerReady; }
|
||||
|
||||
virtual Common::Mutex &mutex() { return _mutex; }
|
||||
|
||||
virtual void playStream(
|
||||
SoundType type,
|
||||
SoundHandle *handle,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue