diff --git a/include/shell/shell.h b/include/shell/shell.h index afe9dfc2d54..c2883777976 100644 --- a/include/shell/shell.h +++ b/include/shell/shell.h @@ -475,7 +475,7 @@ struct shell_transport { * @brief Shell statistics structure. */ struct shell_stats { - u32_t log_lost_cnt; /*!< Lost log counter.*/ + atomic_t log_lost_cnt; /*!< Lost log counter.*/ }; #ifdef CONFIG_SHELL_STATS diff --git a/subsys/shell/shell_log_backend.c b/subsys/shell/shell_log_backend.c index 9e8ba9358dc..1805c844827 100644 --- a/subsys/shell/shell_log_backend.c +++ b/subsys/shell/shell_log_backend.c @@ -73,7 +73,7 @@ static void flush_expired_messages(const struct shell *shell) log_msg_put(msg.msg); if (IS_ENABLED(CONFIG_SHELL_STATS)) { - shell->stats->log_lost_cnt++; + atomic_inc(&shell->stats->log_lost_cnt); } } else { break;