Fix crash after attempting to kill a non-running thread (#3504)
Fixes #3221
This commit is contained in:
parent
d4353f8084
commit
ad476e1cf9
11
src/Root.cpp
11
src/Root.cpp
|
@ -304,11 +304,14 @@ void cRoot::Start(std::unique_ptr<cSettingsRepositoryInterface> a_OverridesRepo)
|
||||||
m_InputThread.join();
|
m_InputThread.join();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (pthread_kill(m_InputThread.native_handle(), SIGKILL) != 0)
|
if (m_InputThread.get_id() != std::thread::id())
|
||||||
{
|
{
|
||||||
LOGWARN("Couldn't notify the input thread; the server will hang before shutdown!");
|
if (pthread_kill(m_InputThread.native_handle(), SIGKILL) != 0)
|
||||||
m_TerminateEventRaised = true;
|
{
|
||||||
m_InputThread.detach();
|
LOGWARN("Couldn't notify the input thread; the server will hang before shutdown!");
|
||||||
|
m_TerminateEventRaised = true;
|
||||||
|
m_InputThread.detach();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user