subsys/console: Yield on char availability.

If this is not done, there is common pattern that on big input block
(e.g. from a clipboard paste), IRQ routine is called in a tight loop,
leading to circular buffer overflow.

Change-Id: I69a7aa78081b8d74652406f3b3a577ddaf4c5f6f
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This commit is contained in:
Paul Sokolovsky 2017-04-05 09:54:15 +03:00 committed by Anas Nashif
commit 4e2eaec268

View file

@ -30,6 +30,10 @@ static int console_irq_input_hook(uint8_t c)
uart_ringbuf[i_put] = c;
i_put = i_next;
k_sem_give(&uart_sem);
/** Allow waiting threads to pick up a char ASAP, or there can be
* buffer overflow.
*/
k_yield();
return 1;
}