Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp =================================================================== --- source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -3564,9 +3564,9 @@ void NativeProcessLinux::StopMonitor() { - StopOpThread(); StopMonitoringChildProcess(); StopCoordinatorThread (); + StopOpThread(); sem_destroy(&m_operation_pending); sem_destroy(&m_operation_done); @@ -3583,7 +3583,16 @@ if (!m_operation_thread.IsJoinable()) return; - DoOperation(nullptr); // nullptr as operation ask the operation thread to exit + // If the state is invalid, attaching or launching then the operation thread will exit on there + // own. We don't have to send explicit stop request. + lldb::StateType state = GetState(); + if (state != StateType::eStateInvalid && + state != StateType::eStateAttaching && + state != StateType::eStateLaunching) + { + DoOperation(nullptr); // nullptr as operation ask the operation thread to exit + } + m_operation_thread.Join(nullptr); }