[llvm-branch-commits] [compiler-rt] [lsan] Process non-suspended threads (PR #112807)

Florian Mayer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Oct 18 10:17:29 PDT 2024


================
@@ -559,6 +581,24 @@ static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
 
     DirectMemoryAccessor accessor;
     ProcessThread(os_id, sp, registers, extra_ranges, frontier, accessor);
+    done_threads.push_back(os_id);
+  }
+
+  if (flags()->use_detached) {
+    CopyMemoryAccessor accessor;
+    InternalMmapVector<tid_t> known_threads;
+    GetRunningThreadsLocked(&known_threads);
+    Sort(done_threads.data(), done_threads.size());
+    for (tid_t os_id : known_threads) {
+      registers.clear();
+      extra_ranges.clear();
+
+      uptr i = InternalLowerBound(done_threads, os_id);
----------------
fmayer wrote:

maybe slightly easier to understand?

```
bool in_done_threads = i < done_threads.size() && done_threads[i] == os_id;

if(!in_done_threads)
```

up to you

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


More information about the llvm-branch-commits mailing list