Skip to content

Commit

Permalink
Make sure chip-tool interactive cleanup happens on the Matter thread. (
Browse files Browse the repository at this point in the history
…#21661)

The interactive cleanup happens while the event loop is still running
(during the execution of the "interactive" command), so queuing the
cleanup on the event loop is reasonable.  And this ensures cleanups
don't run into MAtter locking assertions.
  • Loading branch information
bzbarsky-apple authored Aug 8, 2022
1 parent 117dd16 commit 4b366e2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/common/CHIPCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ void CHIPCommand::StopWaiting()
#endif // CONFIG_USE_SEPARATE_EVENTLOOP
}

void CHIPCommand::ExecuteDeferredCleanups()
void CHIPCommand::ExecuteDeferredCleanups(intptr_t ignored)
{
for (auto * cmd : sDeferredCleanups)
{
Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/common/CHIPCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class CHIPCommand : public Command
virtual bool DeferInteractiveCleanup() { return false; }

// Execute any deferred cleanups. Used when exiting interactive mode.
void ExecuteDeferredCleanups();
static void ExecuteDeferredCleanups(intptr_t ignored);

#ifdef CONFIG_USE_LOCAL_STORAGE
PersistentStorage mDefaultStorage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ bool InteractiveStartCommand::ParseCommand(char * command)
{
if (strcmp(command, kInteractiveModeStopCommand) == 0)
{
ExecuteDeferredCleanups();
chip::DeviceLayer::PlatformMgr().ScheduleWork(ExecuteDeferredCleanups, 0);
return false;
}

Expand Down

0 comments on commit 4b366e2

Please sign in to comment.