diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2006-04-16 03:24:28 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2006-04-16 03:24:28 +0000 |
commit | 8a162b1a360d7a9c7849ca6da45bb66e523d4456 (patch) | |
tree | ddd819eeeee0e22a9ac6e0a4b0f65ec8c80ac9c3 /sys/dev | |
parent | b548c8dc4ec8bdd1b6dbdab37b13e6913b45ef52 (diff) |
Handle input interrupts in a better manner.
It is only necessary to notify reading processes when the buffer is
empty rather than on every input byte.
From Alexandre Ratchov.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/midi.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/sys/dev/midi.c b/sys/dev/midi.c index 9c2aaf04bf8..4f1cb931a9c 100644 --- a/sys/dev/midi.c +++ b/sys/dev/midi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: midi.c,v 1.13 2006/04/07 22:41:32 jsg Exp $ */ +/* $OpenBSD: midi.c,v 1.14 2006/04/16 03:24:27 jsg Exp $ */ /* * Copyright (c) 2003, 2004 Alexandre Ratchov @@ -90,7 +90,6 @@ midi_iintr(void *addr, int data) { struct midi_softc *sc = (struct midi_softc *)addr; struct midi_buffer *mb = &sc->inbuf; - int s; if (sc->isdying || !sc->isopen || !(sc->flags & FREAD)) return; @@ -102,18 +101,16 @@ midi_iintr(void *addr, int data) #endif if (MIDIBUF_ISFULL(mb)) return; /* discard data */ - - s = splaudio(); + if (MIDIBUF_ISEMPTY(mb)) { + if (sc->rchan) { + sc->rchan = 0; + wakeup(&sc->rchan); + } + selwakeup(&sc->rsel); + if (sc->async) + psignal(sc->async, SIGIO); + } MIDIBUF_WRITE(mb, data); - splx(s); - - if (sc->rchan) { - sc->rchan = 0; - wakeup(&sc->rchan); - } - selwakeup(&sc->rsel); - if (sc->async) - psignal(sc->async, SIGIO); } |