From 73dc7504ff7828c24816f1a79f8edf280d25fa83 Mon Sep 17 00:00:00 2001 From: waker Date: Thu, 19 Apr 2012 21:33:04 +0200 Subject: fix alsa/streamer race condition --- plugins/alsa/alsa.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'plugins/alsa') diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c index 3ea17435..3579e9c3 100644 --- a/plugins/alsa/alsa.c +++ b/plugins/alsa/alsa.c @@ -625,7 +625,12 @@ palsa_thread (void *context) { } err = 0; char buf[period_size * (plugin.fmt.bps>>3) * plugin.fmt.channels]; + UNLOCK; // holding a lock here may cause deadlock in the streamer int bytes_to_write = palsa_callback (buf, period_size * (plugin.fmt.bps>>3) * plugin.fmt.channels); + LOCK; + if (alsa_terminate) { + break; + } if (bytes_to_write >= (plugin.fmt.bps>>3) * plugin.fmt.channels) { UNLOCK; -- cgit v1.2.3