ALSA: fix deadlock under some circumstances

If the write_callback came upon an error during the prepare
phase, and never wrote any frames to the hardware buffer,
and another thread tried to soundio_outstream_destroy, this
would cause a deadlock.

This is now fixed.
This commit is contained in:
Andrew Kelley 2015-10-06 18:50:56 -07:00
parent 9c1a6d4930
commit a3c4f85489

View file

@ -1047,6 +1047,8 @@ static void outstream_thread_run(void *arg) {
if ((snd_pcm_uframes_t)avail == osa->buffer_size_frames) {
outstream->write_callback(outstream, 0, avail);
if (!osa->thread_exit_flag.test_and_set())
return;
continue;
}