diff options
author | cg <cg@FreeBSD.org> | 1999-12-18 22:24:50 +0000 |
---|---|---|
committer | cg <cg@FreeBSD.org> | 1999-12-18 22:24:50 +0000 |
commit | 2257ad71d87de557022e54835c33fe876b1528ef (patch) | |
tree | ee845e6284358a9037275b9e18f638540c4e01dd /sys/dev/sound/pcm/channel.c | |
parent | 42c32f7a3bce72d01778522bc5aefc5269d0183b (diff) | |
download | FreeBSD-src-2257ad71d87de557022e54835c33fe876b1528ef.zip FreeBSD-src-2257ad71d87de557022e54835c33fe876b1528ef.tar.gz |
fix the buffer repetition on ^c problem
Diffstat (limited to 'sys/dev/sound/pcm/channel.c')
-rw-r--r-- | sys/dev/sound/pcm/channel.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index ca16404..271c1a2 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -402,9 +402,7 @@ chn_write(pcm_channel *c, struct uio *buf) timeout = (buf->uio_resid >= b->dl)? hz / 20 : 1; ret = tsleep(b, PRIBIO | PCATCH, "pcmwr", timeout); s = spltty(); -#if notdef if (ret == EINTR) chn_abort(c); -#endif /* notdef */ if (ret == EINTR || ret == ERESTART) break; /* Check for underflow before writing into the buffers. */ chn_checkunderflow(c); @@ -780,20 +778,19 @@ chn_poll(pcm_channel *c, int ev, struct proc *p) int chn_abort(pcm_channel *c) { - long s; - int missing = 0; + int missing = 0, cnt = 0; snd_dbuf *b = &c->buffer; snd_dbuf *bs = &c->buffer2nd; - s = spltty(); - if (b->dl) { - b->dl = 0; - c->flags &= ~((c->direction == PCMDIR_PLAY)? CHN_F_WRITING : CHN_F_READING); - chn_trigger(c, PCMTRIG_ABORT); - chn_dmadone(c); - } + if (!b->dl) return 0; + c->flags |= CHN_F_ABORTING; + while (!b->underflow && (b->dl > 0) && (cnt < 20)) { + tsleep((caddr_t)b, PRIBIO, "pcmabr", hz / 20); + cnt++; + } + chn_trigger(c, PCMTRIG_ABORT); + b->dl = 0; missing = b->rl + bs->rl; - splx(s); return missing; } |