Fix flaky tests: add iteration guards, yield in busy-waits, cap thread count

libeigen/eigen!2208

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
Rasmus Munk Larsen
2026-02-24 18:29:07 -08:00
parent 28d090a49c
commit 34092d2788
10 changed files with 92 additions and 61 deletions

View File

@@ -74,7 +74,7 @@ const int TestQueue::kQueueSize;
// fake queues. Ensure that it does not crash, consumers don't deadlock and
// number of blocked and unblocked threads match.
static void test_stress_eventcount() {
const int kThreads = std::thread::hardware_concurrency();
const int kThreads = (std::min)(static_cast<int>(std::thread::hardware_concurrency()), 16);
static const int kEvents = 1 << 16;
static const int kQueues = 10;