diff options
author | ariff <ariff@FreeBSD.org> | 2007-03-17 17:07:21 +0000 |
---|---|---|
committer | ariff <ariff@FreeBSD.org> | 2007-03-17 17:07:21 +0000 |
commit | 1008dd40e3ccaea2037b43cebc74eb7310fccdd6 (patch) | |
tree | df099de99e511cfda817c2c8db0e8bb873b780ea /sys/dev/sound/pcm/channel.c | |
parent | 07ef309a5ab5c901cf3b3ba8b49c4ad26a811962 (diff) | |
download | FreeBSD-src-1008dd40e3ccaea2037b43cebc74eb7310fccdd6.zip FreeBSD-src-1008dd40e3ccaea2037b43cebc74eb7310fccdd6.tar.gz |
Fix long delay closing/syncing issues on mmaped buffer.
Diffstat (limited to 'sys/dev/sound/pcm/channel.c')
-rw-r--r-- | sys/dev/sound/pcm/channel.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index d099e8b..4eae3b2 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -343,7 +343,7 @@ chn_wrfeed(struct pcm_channel *c) }) #endif - if (c->flags & CHN_F_MAPPED) + if ((c->flags & CHN_F_MAPPED) && !(c->flags & CHN_F_CLOSING)) sndbuf_acquire(bs, NULL, sndbuf_getfree(bs)); amt = sndbuf_getfree(b); @@ -696,9 +696,9 @@ chn_resetbuf(struct pcm_channel *c) int chn_sync(struct pcm_channel *c, int threshold) { - int ret, count, hcount, minflush, resid, residp; struct snd_dbuf *b, *bs; - int syncdelay, blksz; + int ret, count, hcount, minflush, resid, residp, syncdelay, blksz; + u_int32_t cflag; CHN_LOCKASSERT(c); @@ -769,6 +769,8 @@ chn_sync(struct pcm_channel *c, int threshold) "minflush=%d resid=%d\n", __func__, c->timeout, count, minflush, resid); + cflag = c->flags & CHN_F_CLOSING; + c->flags |= CHN_F_CLOSING; while (count > 0 && (resid > 0 || minflush > 0)) { ret = chn_sleep(c, "pcmsyn", c->timeout); if (ret == ERESTART || ret == EINTR) { @@ -805,6 +807,8 @@ chn_sync(struct pcm_channel *c, int threshold) residp = resid; } } + c->flags &= ~CHN_F_CLOSING; + c->flags |= cflag; if (snd_verbose > 3) printf("%s: timeout=%d count=%d hcount=%d resid=%d residp=%d " |