This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF CLI Thread Safe?

In SDK 15.2 is the nrf_cli module completely thread safe?  I was thinking of developing a wrapper to use the CLI module for both application logging as well as a general CLI interface. Since I'm using a freeRTOS arhcitecture I didn't know my wrapper have to make it threadsafe or if the nrf_cli was already developed this way?   I know in nrf_log the deferred setting makes logging thread safe, but I don't see the same option for the CLI module.  

Thanks guys (and Happy New Year)

-DC

Parents
  • Basically it is not thread safe. However you can safely use it with RTOS under following conditions:

    1. CLI commands will be not executed from from multiple contexts (to avoid executing commands at the same time).

    2. nrf_cli_fprintf function will be used only inside command handler. If you wish to print something on the screen from different context you can use Logger module with CLI backend.

Reply
  • Basically it is not thread safe. However you can safely use it with RTOS under following conditions:

    1. CLI commands will be not executed from from multiple contexts (to avoid executing commands at the same time).

    2. nrf_cli_fprintf function will be used only inside command handler. If you wish to print something on the screen from different context you can use Logger module with CLI backend.

Children
Related