Skip to content
Permalink
Browse files

shell: Move signals initialization from thread to init

By moving signals initialization to shell instance init function,
shell instance is ready to receive RX signals from backend before
thread is ready to handle them.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
  • Loading branch information...
nordic-krch authored and carlescufi committed May 13, 2019
1 parent ca4a078 commit 3b99b20ff0c7e5e4650efa8fc955beb25350823b
Showing with 8 additions and 8 deletions.
  1. +8 −8 subsys/shell/shell.c
@@ -1102,6 +1102,14 @@ static int instance_init(const struct shell *shell, const void *p_config,

k_mutex_init(&shell->ctx->wr_mtx);

for (int i = 0; i < SHELL_SIGNALS; i++) {
k_poll_signal_init(&shell->ctx->signals[i]);
k_poll_event_init(&shell->ctx->events[i],
K_POLL_TYPE_SIGNAL,
K_POLL_MODE_NOTIFY_ONLY,
&shell->ctx->signals[i]);
}

if (IS_ENABLED(CONFIG_SHELL_STATS)) {
shell->stats->log_lost_cnt = 0;
}
@@ -1179,14 +1187,6 @@ void shell_thread(void *shell_handle, void *arg_log_backend,
u32_t log_level = (u32_t)arg_log_level;
int err;

for (int i = 0; i < SHELL_SIGNALS; i++) {
k_poll_signal_init(&shell->ctx->signals[i]);
k_poll_event_init(&shell->ctx->events[i],
K_POLL_TYPE_SIGNAL,
K_POLL_MODE_NOTIFY_ONLY,
&shell->ctx->signals[i]);
}

err = shell->iface->api->enable(shell->iface, false);
if (err != 0) {
return;

0 comments on commit 3b99b20

Please sign in to comment.
You can’t perform that action at this time.