-
Hello! I've been developing a complex project involving Bluetooth Mesh API, and I have a question regarding that. In your documentation, you say that Bluetooth API is thread safe unless it's written otherwise: https://docs.zephyrproject.org/latest/connectivity/bluetooth/bluetooth-dev.html#thread-safety
But my understanding is that it touches only classic Bluetooth API, and not the Mesh. Can you please clarify if Bluetooth Mesh is thread-safe or not? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
@PavelVPV FYI |
Beta Was this translation helpful? Give feedback.
-
You should only call Bluetooth Mesh API from a cooperative thread. Do not use the system workqueue to call a synchronous Bluetooth Mesh API as it will block the execution of the mesh stack until the API timeout expires. An example of such API will Config Client or Health Client APIs that use |
Beta Was this translation helpful? Give feedback.
You should only call Bluetooth Mesh API from a cooperative thread. Do not use the system workqueue to call a synchronous Bluetooth Mesh API as it will block the execution of the mesh stack until the API timeout expires. An example of such API will Config Client or Health Client APIs that use
bt_mesh_msg_ack_ctx_match
function (https://github.com/zephyrproject-rtos/zephyr/blob/main/include/zephyr/bluetooth/mesh/msg.h#L257-L258) to receive a response in the same execution context. For example, callingbt_mesh_cfg_cli_app_key_add
with suppliedstatus
argument from the system workqueue will block sending the Config AppKey Add message until this call times out. In such case, the API will return…