Skip to content

Commit

Permalink
[thread] add Thread stack lock held for output the unicast addresses (#…
Browse files Browse the repository at this point in the history
…33661)

* [thread] add Thread stack lock held for output the unicast addresses

* [thread] add Thread stack lock held for output the unicast addresses
  • Loading branch information
ZhangLe2016 authored and pull[bot] committed Aug 13, 2024
1 parent 0e2a02a commit 1301081
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ void GenericThreadStackManagerImpl_OpenThread<ImplClass>::_OnPlatformEvent(const
}

#if CHIP_DETAIL_LOGGING
Impl()->LockThreadStack();
LogOpenThreadStateChange(mOTInst, event->ThreadStateChange.OpenThread.Flags);
Impl()->UnlockThreadStack();
#endif // CHIP_DETAIL_LOGGING
}
}
Expand Down
5 changes: 0 additions & 5 deletions src/platform/OpenThread/OpenThreadUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ void RegisterOpenThreadErrorFormatter(void)
RegisterErrorFormatter(&sOpenThreadErrorFormatter);
}

/**
* Log information related to a state change in the OpenThread stack.
*
* NB: This function *must* be called with the Thread stack lock held.
*/
void LogOpenThreadStateChange(otInstance * otInst, uint32_t flags)
{
#if CHIP_DETAIL_LOGGING
Expand Down
6 changes: 6 additions & 0 deletions src/platform/OpenThread/OpenThreadUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ namespace Internal {

extern CHIP_ERROR MapOpenThreadError(otError otErr);
extern void RegisterOpenThreadErrorFormatter(void);

/**
* Log information related to a state change in the OpenThread stack.
*
* NB: This function *must* be called with the Thread stack lock held.
*/
extern void LogOpenThreadStateChange(otInstance * otInst, uint32_t flags);
extern void LogOpenThreadPacket(const char * titleStr, otMessage * pkt);
extern bool IsOpenThreadMeshLocalAddress(otInstance * otInst, const Inet::IPAddress & addr);
Expand Down

0 comments on commit 1301081

Please sign in to comment.