From: Andre Noll Date: Mon, 6 Jun 2011 06:24:08 +0000 (+0200) Subject: alsa: Avoid busy loop at end of file. X-Git-Tag: v0.4.8~29^2 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=8a5b6bf798581bdf49e39084f456bce07c01b498;hp=6d6ede092858166d203a39da1734bd715d47cf1d alsa: Avoid busy loop at end of file. During the drain period at the end of input the status of the alsa buffer tree node is negative, yet we should not request a minimal scheduler delay until the end of this period. --- diff --git a/alsa_write.c b/alsa_write.c index 047eeaa3..1c168e7b 100644 --- a/alsa_write.c +++ b/alsa_write.c @@ -150,8 +150,10 @@ static void alsa_write_pre_select(struct sched *s, struct task *t) if (ret == 0) return; - if (ret < 0 || !pad) + if (!pad) return sched_min_delay(s); + if (ret < 0) + return sched_request_barrier_or_min_delay(&pad->drain_barrier, s); /* * Data is available to be written to the alsa handle. Compute number * of milliseconds until next buffer underrun would occur.