From c057cc10d4732bf66cea00b5ebbc74a72bd02581 Mon Sep 17 00:00:00 2001 From: Jiacheng Guo Date: Fri, 21 Jan 2022 12:21:21 +0800 Subject: [PATCH] cli: lock Thread stack when calling OpenThread API --- examples/shell/shell_common/cmd_otcli.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/shell/shell_common/cmd_otcli.cpp b/examples/shell/shell_common/cmd_otcli.cpp index 7c67b450db07eb..dbb8128d265b6e 100644 --- a/examples/shell/shell_common/cmd_otcli.cpp +++ b/examples/shell/shell_common/cmd_otcli.cpp @@ -105,11 +105,13 @@ CHIP_ERROR cmd_otcli_dispatch(int argc, char ** argv) } } buff_ptr = 0; + chip::DeviceLayer::ThreadStackMgr().LockThreadStack(); #if OPENTHREAD_API_VERSION >= 85 otCliInputLine(buff); #else otCliConsoleInputLine(buff, buff_ptr - buff); #endif + chip::DeviceLayer::ThreadStackMgr().UnlockThreadStack(); exit: return error; }