[Lldb-commits] [lldb] [lldb/test] Add yield to spin loop in thread_filter test (PR #191025)

Dmitry Vasilyev via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 8 12:45:23 PDT 2026


slydiman wrote:

The Windows worker is busy now, so we will see the results of the buildbot [lldb-x86_64-win](https://lab.llvm.org/buildbot/#/builders/211/builds/7441) later. 
But I have reproduced the timeout locally. 

It seems the debugger needs some time anyway after running all 3 threads.
Note the test now is marked `@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")`
I got the test `unexpected successes` with the following `main.cpp`:
```
#include <atomic>
#include <chrono>
#include <thread>
#include <vector>

#define NUM_THREADS 3

std::atomic<int> g_barrier(NUM_THREADS);
volatile bool g_spin = true;

void thread_work() {
  --g_barrier;
  while (g_barrier > 0)
    ;
  std::this_thread::sleep_for(std::chrono::seconds(1));
  while (g_spin) // break in thread
    std::this_thread::yield();
}

int main() {
  std::vector<std::thread> threads;
  for (int i = 0; i < NUM_THREADS; i++)
    threads.emplace_back(thread_work);
  for (auto &t : threads)
    t.join();             
  return 0;
}
```

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


More information about the lldb-commits mailing list