Index: lldb/tools/lldb-vscode/ProgressEvent.cpp =================================================================== --- lldb/tools/lldb-vscode/ProgressEvent.cpp +++ lldb/tools/lldb-vscode/ProgressEvent.cpp @@ -179,15 +179,24 @@ : m_report_callback(report_callback) { m_thread_should_exit = false; m_thread = std::thread([&] { - while (!m_thread_should_exit) { - std::this_thread::sleep_for(kUpdateProgressEventReportDelay); - ReportStartEvents(); + while (true) { + m_mutex.lock(); + bool thread_should_exit = m_thread_should_exit; + m_mutex.unlock(); + if (!thread_should_exit) { + std::this_thread::sleep_for(kUpdateProgressEventReportDelay); + ReportStartEvents(); + } else { + break; + } } }); } ProgressEventReporter::~ProgressEventReporter() { + m_mutex.lock(); m_thread_should_exit = true; + m_mutex.unlock(); m_thread.join(); }