Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions test/unit/contrib/parallel/buffer_queue_parallel_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@
template <typename sequential_push_t, typename sequential_pop_t>
void test_buffer_queue_wait_status()
{
size_t thread_count = std::thread::hardware_concurrency();

// limit thread count as virtualbox (used by Travis) seems to have problems with thread congestion
if (thread_count > 4)
thread_count = 4;
// At least two threads (one producer and one consumer), at most 4 threads (avoid congestion).
size_t thread_count = std::clamp<size_t>(std::thread::hardware_concurrency(), 2u, 4u);

size_t writer_count = thread_count / 2;
if constexpr (sequential_push_t::value)
Expand Down Expand Up @@ -129,11 +126,9 @@ void test_buffer_queue_wait_throw(size_t initialCapacity)
}

volatile std::atomic<size_t> chk_sum2 = 0;
size_t thread_count = std::thread::hardware_concurrency();

// limit thread count as virtualbox (used by Travis) seems to have problems with thread congestion
if (thread_count > 4)
thread_count = 4;
// At least two threads (one producer and one consumer), at most 4 threads (avoid congestion).
size_t thread_count = std::clamp<size_t>(std::thread::hardware_concurrency(), 2u, 4u);

size_t writer_count = thread_count / 2;
if constexpr (sequential_push_t::value)
Expand Down