mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Fix ThreadPool usage in gtest_thread_pool_limit
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
parent
ba6ecd2d4e
commit
f69441b633
@ -1,16 +1,23 @@
|
||||
#include <atomic>
|
||||
#include <iostream>
|
||||
#include <Common/ThreadPool.h>
|
||||
#include <Common/CurrentMetrics.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
namespace CurrentMetrics
|
||||
{
|
||||
extern const Metric LocalThread;
|
||||
extern const Metric LocalThreadActive;
|
||||
}
|
||||
|
||||
/// Test for thread self-removal when number of free threads in pool is too large.
|
||||
/// Just checks that nothing weird happens.
|
||||
|
||||
template <typename Pool>
|
||||
int test()
|
||||
{
|
||||
Pool pool(10, 2, 10);
|
||||
Pool pool(CurrentMetrics::LocalThread, CurrentMetrics::LocalThreadActive, 10, 2, 10);
|
||||
|
||||
std::atomic<int> counter{0};
|
||||
for (size_t i = 0; i < 10; ++i)
|
||||
|
Loading…
Reference in New Issue
Block a user