1
0

Fix crash after attempting to kill a non-running thread (#3504)

Fixes #3221
This commit is contained in:
Fabian Stein 2017-01-01 22:43:24 +01:00 committed by Mattes D
parent d4353f8084
commit ad476e1cf9

View File

@ -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