[Lldb-commits] [lldb] [lldb][windows] Fix HostThreadWindows::Join dead-code on GetExitCodeThread failure (PR #199014)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu May 21 05:39:40 PDT 2026


================
@@ -31,18 +31,22 @@ HostThreadWindows::~HostThreadWindows() { Reset(); }
 void HostThreadWindows::SetOwnsHandle(bool owns) { m_owns_handle = owns; }
 
 Status HostThreadWindows::Join(lldb::thread_result_t *result) {
+  if (!IsJoinable())
+    return Status(ERROR_INVALID_HANDLE, eErrorTypeWin32);
+
   Status error;
-  if (IsJoinable()) {
-    DWORD wait_result = ::WaitForSingleObject(m_thread, INFINITE);
-    if (WAIT_OBJECT_0 == wait_result && result) {
+  DWORD wait_result = ::WaitForSingleObject(m_thread, INFINITE);
+  if (wait_result == WAIT_OBJECT_0) {
+    if (result) {
----------------
DavidSpickett wrote:

Was going to ask for early returns, but you need to call Reset() at the end of each code path, so early returns creates more noise than it removes.

https://github.com/llvm/llvm-project/pull/199014


More information about the lldb-commits mailing list