diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-04-04 15:36:03 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-04-04 17:14:53 +0300 |
commit | 58168c8e6bcf3619d281a8c877ef20e5efe049d2 (patch) | |
tree | 454e5255cd166c54eaf325f5ad6de43c9e35e628 /zephyr/src/zephyr_getchar.c | |
parent | 468c6f9da147d6e752e437a32211e317a116b6df (diff) | |
download | micropython-58168c8e6bcf3619d281a8c877ef20e5efe049d2.tar.gz micropython-58168c8e6bcf3619d281a8c877ef20e5efe049d2.zip |
zephyr/zephyr_getchar: Explicitly yield to other threads on char availability.
Without this, if there's a large chunk of data coming from hardware (e.g.
clipboard paste, or fed programmatically from the other side of the console),
there's a behavior of initial mass fill-in of the buffer without any
consumption, which starts much later and doesn't catch up with further
filling, leading to buffer overflow.
Diffstat (limited to 'zephyr/src/zephyr_getchar.c')
-rw-r--r-- | zephyr/src/zephyr_getchar.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/zephyr/src/zephyr_getchar.c b/zephyr/src/zephyr_getchar.c index 246d86a2ef..52b3394d03 100644 --- a/zephyr/src/zephyr_getchar.c +++ b/zephyr/src/zephyr_getchar.c @@ -44,6 +44,7 @@ static int console_irq_input_hook(uint8_t ch) } //printk("%x\n", ch); k_sem_give(&uart_sem); + k_yield(); return 1; } |