output/alsa: fix race condition on early snd_pcm_writei() error
During UnlockActivate() while the mutex is unlocked, the IOThread can set a new error condition, and will never again wake up the OutputThread. This race condition can cause a deadlock in the OutputThread.
This commit is contained in:
parent
6636c69a11
commit
47dffe66aa
@ -1211,6 +1211,12 @@ AlsaOutput::Play(const void *chunk, size_t size)
|
|||||||
snd_pcm_writei() */
|
snd_pcm_writei() */
|
||||||
UnlockActivate();
|
UnlockActivate();
|
||||||
|
|
||||||
|
/* check the error again, because a new one may have
|
||||||
|
been set while our mutex was unlocked in
|
||||||
|
UnlockActivate() */
|
||||||
|
if (error)
|
||||||
|
std::rethrow_exception(error);
|
||||||
|
|
||||||
/* wait for the DispatchSockets() to make room in the
|
/* wait for the DispatchSockets() to make room in the
|
||||||
ring_buffer */
|
ring_buffer */
|
||||||
cond.wait(mutex);
|
cond.wait(mutex);
|
||||||
|
Loading…
Reference in New Issue
Block a user