Skip to content

Commit

Permalink
Fix the deadlock issue during shutdown the system layer (#28094)
Browse files Browse the repository at this point in the history
When the app calls PlatformManager's Shutdown API twice,
the function tries to join the abnormal main loop's thread.
Adds the prevent function to avoid this deadlock issue.
  • Loading branch information
dh79pyun authored and pull[bot] committed Mar 1, 2024
1 parent 2f336c6 commit 1500264
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/platform/Tizen/PlatformManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,19 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack()

void PlatformManagerImpl::_Shutdown()
{
if (mGLibMainLoop == nullptr)
{
ChipLogError(DeviceLayer, "System Layer is already shutdown.");
return;
}

Internal::GenericPlatformManagerImpl_POSIX<PlatformManagerImpl>::_Shutdown();

g_main_loop_quit(mGLibMainLoop);
g_main_loop_unref(mGLibMainLoop);
g_thread_join(mGLibMainLoopThread);

mGLibMainLoop = nullptr;
}

CHIP_ERROR PlatformManagerImpl::_GLibMatterContextInvokeSync(CHIP_ERROR (*func)(void *), void * userData)
Expand Down

0 comments on commit 1500264

Please sign in to comment.