shell: fix polling TXDONE signal by multiple threads
This patch fixes the issue that can cause a deadlock in shell. When two threads simultaneously poll the TXDONE signal, only one of them will receive it, leaving second one stalled. The problem was that shell's context contains k_poll_event objects that were polled by multiple threads. Polling it overwrites the poller field that was set by previous thread. Instead, the k_poll_event object must be created on the stack by every thread that wants to poll the TXDONE signal. This makes sure that no thread will be left waiting for this signal forever. Signed-off-by: Michał Barnaś <mb@semihalf.com>
This commit is contained in:
parent
b30ae46aa0
commit
01a01de594
2 changed files with 11 additions and 1 deletions
|
@ -698,6 +698,10 @@ struct shell_ctx {
|
|||
volatile union shell_internal internal; /*!< Internal shell data.*/
|
||||
|
||||
struct k_poll_signal signals[SHELL_SIGNALS];
|
||||
|
||||
/*!< Events that should be used only internally by shell thread.
|
||||
* Event for SHELL_SIGNAL_TXDONE is initialized but unused.
|
||||
*/
|
||||
struct k_poll_event events[SHELL_SIGNALS];
|
||||
|
||||
struct k_mutex wr_mtx;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue