diff --git a/include/shell/shell.h b/include/shell/shell.h index 0af25a3ee77..04b07b83d50 100644 --- a/include/shell/shell.h +++ b/include/shell/shell.h @@ -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; diff --git a/subsys/shell/shell_ops.c b/subsys/shell/shell_ops.c index d2a2a4048c8..b35b262fdd8 100644 --- a/subsys/shell/shell_ops.c +++ b/subsys/shell/shell_ops.c @@ -369,7 +369,13 @@ static void shell_pend_on_txdone(const struct shell *shell) { if (IS_ENABLED(CONFIG_MULTITHREADING) && (shell->ctx->state < SHELL_STATE_PANIC_MODE_ACTIVE)) { - k_poll(&shell->ctx->events[SHELL_SIGNAL_TXDONE], 1, K_FOREVER); + struct k_poll_event event; + + k_poll_event_init(&event, + K_POLL_TYPE_SIGNAL, + K_POLL_MODE_NOTIFY_ONLY, + &shell->ctx->signals[SHELL_SIGNAL_TXDONE]); + k_poll(&event, 1, K_FOREVER); k_poll_signal_reset(&shell->ctx->signals[SHELL_SIGNAL_TXDONE]); } else { /* Blocking wait in case of bare metal. */