ClickHouse/dbms/src/Common/tests/thread_pool_2.cpp

22 lines
397 B
C++
Raw Normal View History

#include <atomic>
#include <iostream>
2019-01-13 18:51:57 +00:00
#include <Common/ThreadPool.h>
int main(int, char **)
{
std::atomic<size_t> res{0};
for (size_t i = 0; i < 1000; ++i)
{
size_t threads = 16;
ThreadPool pool(threads);
for (size_t j = 0; j < threads; ++j)
pool.schedule([&]{ ++res; });
pool.wait();
}
std::cerr << res << "\n";
return 0;
}