Commit 47dffe66 authored by Max Kellermann's avatar Max Kellermann

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.
parent 6636c69a
......@@ -1211,6 +1211,12 @@ AlsaOutput::Play(const void *chunk, size_t size)
snd_pcm_writei() */
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
ring_buffer */
cond.wait(mutex);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment