aboutsummaryrefslogtreecommitdiff
path: root/lldb/tools/lldb-dap/DAP.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/tools/lldb-dap/DAP.cpp')
-rw-r--r--lldb/tools/lldb-dap/DAP.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 3c4f225..f009a90 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -1104,9 +1104,11 @@ llvm::Error DAP::Loop() {
"unhandled packet");
}
- m_loop.AddPendingCallback(
- [](MainLoopBase &loop) { loop.RequestTermination(); });
- thread.join();
+ // Don't wait to join the mainloop thread if our callback wasn't added
+ // successfully, or we'll wait forever.
+ if (m_loop.AddPendingCallback(
+ [](MainLoopBase &loop) { loop.RequestTermination(); }))
+ thread.join();
if (m_error_occurred)
return llvm::createStringError(llvm::inconvertibleErrorCode(),