Skip to content

Commit

Permalink
Avoid deadlock when stopping event loop on non-matter thread
Browse files Browse the repository at this point in the history
  • Loading branch information
arkq committed Apr 26, 2023
1 parent b637b4d commit c60cab3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/platform/tests/TestDnssd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@ static void HandleResolve(void * context, DnssdService * result, const chip::Spa
if (ctx->mBrowsedServicesCount == ++ctx->mResolvedServicesCount)
{
chip::DeviceLayer::SystemLayer().CancelTimer(Timeout, context);
// After last service is resolved, stop the event loop,
// so the test case can gracefully exit.
chip::DeviceLayer::PlatformMgr().StopEventLoopTask();
chip::DeviceLayer::SystemLayer().ScheduleLambda([]() {
// After last service is resolved, stop the event loop,
// so the test case can gracefully exit.
chip::DeviceLayer::PlatformMgr().StopEventLoopTask();
});
}
}

Expand Down

0 comments on commit c60cab3

Please sign in to comment.