aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.cpp')
-rw-r--r--lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.cpp b/lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.cpp
index 390cf3e..77a3ba6 100644
--- a/lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.cpp
+++ b/lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.cpp
@@ -133,11 +133,12 @@ llvm::Error ProtocolServerMCP::Stop() {
}
// Stop the main loop.
- m_loop.AddPendingCallback(
+ bool addition_succeeded = m_loop.AddPendingCallback(
[](lldb_private::MainLoopBase &loop) { loop.RequestTermination(); });
- // Wait for the main loop to exit.
- if (m_loop_thread.joinable())
+ // Wait for the main loop to exit, but not if we didn't succeed in inserting
+ // our pending callback or we'll wait forever.
+ if (addition_succeeded && m_loop_thread.joinable())
m_loop_thread.join();
m_accept_handles.clear();