diff options
author | Luo Jinghua <sunmoon1997@gmail.com> | 2012-12-25 15:42:31 +0800 |
---|---|---|
committer | Luo Jinghua <sunmoon1997@gmail.com> | 2012-12-25 15:42:31 +0800 |
commit | b3d655b2b7752d0dbf747556712b1f80511c94af (patch) | |
tree | 17cabf1fe18eb4639a369f646d51df7a345a6a4e /src | |
parent | a4b7f63c0032bbc5b112987d35e8e5510faaa573 (diff) |
Fix the dead lock issue in ThreadedMixerDevice destructor
Diffstat (limited to 'src')
-rw-r--r-- | src/audiere.h | 5 | ||||
-rw-r--r-- | src/device.cpp | 5 | ||||
-rw-r--r-- | src/device.h | 1 |
3 files changed, 11 insertions, 0 deletions
diff --git a/src/audiere.h b/src/audiere.h index 4403637..52a0d0d 100644 --- a/src/audiere.h +++ b/src/audiere.h @@ -791,6 +791,11 @@ namespace audiere { * Resume the audio device. */ ADR_METHOD(void) resume() = 0; + + /** + * Shutdown the audio device. + */ + ADR_METHOD(void) shutdown() = 0; }; typedef RefPtr<AudioDevice> AudioDevicePtr; diff --git a/src/device.cpp b/src/device.cpp index 22c6756..991058c 100644 --- a/src/device.cpp +++ b/src/device.cpp @@ -375,6 +375,7 @@ namespace audiere { ~ThreadedDevice() { m_thread_should_die = true; + shutdown(); while (m_thread_exists) { AI_Sleep(50); } @@ -421,6 +422,10 @@ namespace audiere { m_device->resume(); } + void ADR_CALL shutdown() { + m_device->shutdown(); + } + private: void run() { ADR_GUARD("ThreadedDevice::run"); diff --git a/src/device.h b/src/device.h index 63187e5..a0b7979 100644 --- a/src/device.h +++ b/src/device.h @@ -43,6 +43,7 @@ namespace audiere { void ADR_CALL clearCallbacks(); void ADR_CALL pause() {} void ADR_CALL resume() {} + void ADR_CALL shutdown() {} protected: void fireStopEvent(OutputStream* stream, StopEvent::Reason reason); |