summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-05-05 00:44:42 -0700
committerKeith Packard <keithp@keithp.com>2010-05-05 00:44:42 -0700
commitf7ff3278bb670df59d7425a014cfe8e3718fea3f (patch)
tree435f9e37d36379b4b0fe837e7d0fa0c3b24bd423 /src
parentaa9ff021d683764a43800eaa18ea0c9be5134939 (diff)
Disable interrupts while reading from stdin
With multiple input source support, there is a lag between asking a device if it has data and then waiting for more data to appear. If an interrupt signalling additional input arrives in this interval, we'll go to sleep with input available. This patch uses a big hammer by just disabling interrupts for the whole process. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r--src/ao_stdio.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/ao_stdio.c b/src/ao_stdio.c
index 8add30b8..045dff09 100644
--- a/src/ao_stdio.c
+++ b/src/ao_stdio.c
@@ -50,6 +50,7 @@ getchar(void) __reentrant
char c;
int8_t stdio = ao_cur_stdio;
+ EA = 0;
for (;;) {
c = stdios[stdio].pollchar();
if (c != AO_READ_AGAIN)
@@ -59,6 +60,7 @@ getchar(void) __reentrant
if (stdio == ao_cur_stdio)
ao_sleep(&ao_stdin_ready);
}
+ EA = 1;
ao_cur_stdio = stdio;
return c;
}