diff --git a/src/Root.cpp b/src/Root.cpp index 2a00c5cfa..3d3930975 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -304,11 +304,14 @@ void cRoot::Start(std::unique_ptr a_OverridesRepo) m_InputThread.join(); } #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!"); - m_TerminateEventRaised = true; - m_InputThread.detach(); + if (pthread_kill(m_InputThread.native_handle(), SIGKILL) != 0) + { + LOGWARN("Couldn't notify the input thread; the server will hang before shutdown!"); + m_TerminateEventRaised = true; + m_InputThread.detach(); + } } #endif