diff options
author | waker <wakeroid@gmail.com> | 2012-04-19 21:33:04 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2012-04-19 21:33:04 +0200 |
commit | 73dc7504ff7828c24816f1a79f8edf280d25fa83 (patch) | |
tree | fe5b9d93b11302fb244d6c59172bcbd540dc91aa /plugins/alsa | |
parent | 1528c9df3a60dc7e9a1bf66290ce4e2ae434ff37 (diff) |
fix alsa/streamer race condition
Diffstat (limited to 'plugins/alsa')
-rw-r--r-- | plugins/alsa/alsa.c | 5 |
1 files changed, 5 insertions, 0 deletions
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; |