Skip to content

Commit 58168c8

Browse files
committed
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.
1 parent 468c6f9 commit 58168c8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

zephyr/src/zephyr_getchar.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ static int console_irq_input_hook(uint8_t ch)
4444
}
4545
//printk("%x\n", ch);
4646
k_sem_give(&uart_sem);
47+
k_yield();
4748
return 1;
4849
}
4950

0 commit comments

Comments
 (0)