Skip to content

Commit

Permalink
Fix the deadlock issue during shutdown the system layer
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 committed Jul 20, 2023
1 parent 1694d34 commit 9d006f1
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 @@ -131,9 +131,17 @@ void PlatformManagerImpl::_Shutdown()
{
Internal::GenericPlatformManagerImpl_POSIX<PlatformManagerImpl>::_Shutdown();

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

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 9d006f1

Please sign in to comment.