daniilavdeev wrote:

I am not confident that using `pthread_attr_setdetachstate`, or similar 
mechanisms that change the detach state at thread creation time, is the best 
approach here, as `HostThread` appears to expects the thread to be joinable. To 
avoid breaking these expectations and make the logic less entangled, it seems 
preferable to explicitly detach the thread after its creation.

Given that the `StartMonitoring` logic already diverges between the Windows and 
the POSIX parts, the appropriate handling could be introduced there. 
`POSIXNativeThread` provides a `Detach()` method, which invokes 
`pthread_detach()` and updates the HostThread state accordingly. Meanwhile, 
`WindowsNativeThread` has a corresponding `Reset()` method, which calls 
`CloseHandle()`.

I am far from being an expert in the Windows API, yet my understanding is that 
`CloseHandle()` serves a similar role to `pthread_detach()` on POSIX platforms.

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

Reply via email to