From 4e01ceeb2071ee2a53ea4fd3bba8759f292d504d Mon Sep 17 00:00:00 2001 From: Sergei Lissianoi <54454955+selissia@users.noreply.github.com> Date: Wed, 31 Aug 2022 16:06:03 -0400 Subject: [PATCH] Use a separate execution thread to disable the OpenThread interface (#22315) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Test added march 8 (#15957) * Added new manual scripts * Added Auto generated File * [OTA] Fix OTARequestorDriverImpl inclusion (#15981) * Regen to fix CI failures (#15990) * [ota] Store Default OTA Providers in flash (#15970) * [ota] Store Default OTA Providers in flash Store Default OTA Providers in flash each time the attribute is modified and load it back on the application startup. * Restyled by clang-format * Fix build and reduce flash usage Co-authored-by: Restyled.io * Disable OpenThread interface in a separate execution thread * Remove merge artifacts * Restyled by clang-format Co-authored-by: kowsisoundhar12 <57476670+kowsisoundhar12@users.noreply.github.com> Co-authored-by: Carol Yang Co-authored-by: Boris Zbarsky Co-authored-by: Damian Królik <66667989+Damian-Nordic@users.noreply.github.com> Co-authored-by: Restyled.io --- .../OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp index 3fde426337db7d..6d8506de69769a 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp @@ -453,7 +453,11 @@ void GenericThreadStackManagerImpl_OpenThread::_OnNetworkScanFinished // If Thread scanning was done before commissioning, turn off the IPv6 interface. if (otThreadGetDeviceRole(mOTInst) == OT_DEVICE_ROLE_DISABLED && !otDatasetIsCommissioned(mOTInst)) { - otIp6SetEnabled(mOTInst, false); + DeviceLayer::SystemLayer().ScheduleLambda([this]() { + Impl()->LockThreadStack(); + otIp6SetEnabled(mOTInst, false); + Impl()->UnlockThreadStack(); + }); } if (mpScanCallback != nullptr)