llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: None (daniilavdeev)

<details>
<summary>Changes</summary>

Remove the Detach() method from HostThreadPosix and instead override the 
virtual Reset() function from HostNativeThreadBase, following the pattern 
already used by HostThreadWindows. This provides a consistent interface for 
platform-specific thread cleanup on all platforms.

The HostThreadPosix::Reset() implementation first calls pthread_detach() before 
delegating to the base implementation HostNativeThreadBase::Reset(), similar to 
how HostThreadWindows calls CloseHandle() in its Reset() override.

---
Full diff: https://github.com/llvm/llvm-project/pull/179470.diff


2 Files Affected:

- (modified) lldb/include/lldb/Host/posix/HostThreadPosix.h (+1-1) 
- (modified) lldb/source/Host/posix/HostThreadPosix.cpp (+4-8) 


``````````diff
diff --git a/lldb/include/lldb/Host/posix/HostThreadPosix.h 
b/lldb/include/lldb/Host/posix/HostThreadPosix.h
index 6c8e09fc11030..32be7154fa1d8 100644
--- a/lldb/include/lldb/Host/posix/HostThreadPosix.h
+++ b/lldb/include/lldb/Host/posix/HostThreadPosix.h
@@ -25,7 +25,7 @@ class HostThreadPosix : public HostNativeThreadBase {
   Status Join(lldb::thread_result_t *result) override;
   Status Cancel() override;
 
-  Status Detach();
+  void Reset() override;
 };
 
 } // namespace lldb_private
diff --git a/lldb/source/Host/posix/HostThreadPosix.cpp 
b/lldb/source/Host/posix/HostThreadPosix.cpp
index a53a8cc9d8389..92f172ecd00a5 100644
--- a/lldb/source/Host/posix/HostThreadPosix.cpp
+++ b/lldb/source/Host/posix/HostThreadPosix.cpp
@@ -50,12 +50,8 @@ Status HostThreadPosix::Cancel() {
   return error;
 }
 
-Status HostThreadPosix::Detach() {
-  Status error;
-  if (IsJoinable()) {
-    int err = ::pthread_detach(m_thread);
-    error = Status(err, eErrorTypePOSIX);
-  }
-  Reset();
-  return error;
+void HostThreadPosix::Reset() {
+  if (IsJoinable())
+    ::pthread_detach(m_thread);
+  HostNativeThreadBase::Reset();
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/179470
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to