Skip to content

Commit 95fc18c

Browse files
authored
[thread] add Thread stack lock held for output the unicast addresses (#33661)
* [thread] add Thread stack lock held for output the unicast addresses * [thread] add Thread stack lock held for output the unicast addresses
1 parent 909c69b commit 95fc18c

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,9 @@ void GenericThreadStackManagerImpl_OpenThread<ImplClass>::_OnPlatformEvent(const
247247
}
248248

249249
#if CHIP_DETAIL_LOGGING
250+
Impl()->LockThreadStack();
250251
LogOpenThreadStateChange(mOTInst, event->ThreadStateChange.OpenThread.Flags);
252+
Impl()->UnlockThreadStack();
251253
#endif // CHIP_DETAIL_LOGGING
252254
}
253255
}

src/platform/OpenThread/OpenThreadUtils.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ void RegisterOpenThreadErrorFormatter(void)
8787
RegisterErrorFormatter(&sOpenThreadErrorFormatter);
8888
}
8989

90-
/**
91-
* Log information related to a state change in the OpenThread stack.
92-
*
93-
* NB: This function *must* be called with the Thread stack lock held.
94-
*/
9590
void LogOpenThreadStateChange(otInstance * otInst, uint32_t flags)
9691
{
9792
#if CHIP_DETAIL_LOGGING

src/platform/OpenThread/OpenThreadUtils.h

+6
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ namespace Internal {
6060

6161
extern CHIP_ERROR MapOpenThreadError(otError otErr);
6262
extern void RegisterOpenThreadErrorFormatter(void);
63+
64+
/**
65+
* Log information related to a state change in the OpenThread stack.
66+
*
67+
* NB: This function *must* be called with the Thread stack lock held.
68+
*/
6369
extern void LogOpenThreadStateChange(otInstance * otInst, uint32_t flags);
6470
extern void LogOpenThreadPacket(const char * titleStr, otMessage * pkt);
6571
extern bool IsOpenThreadMeshLocalAddress(otInstance * otInst, const Inet::IPAddress & addr);

0 commit comments

Comments
 (0)