Skip to content

Commit d8cceb3

Browse files
serxailejn
authored andcommitted
Merge pull request ClickHouse#68694 from filimonov/thread_pool_thread_creation_out_of_lock
Thread pool: move thread creation out of lock
1 parent c73183a commit d8cceb3

File tree

3 files changed

+397
-93
lines changed

3 files changed

+397
-93
lines changed

src/Common/AsyncLoader.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ AsyncLoader::Pool::Pool(const AsyncLoader::PoolInitializer & init)
5151
, priority(init.priority)
5252
, max_threads(init.max_threads > 0 ? init.max_threads : getNumberOfPhysicalCPUCores())
5353
, thread_pool(std::make_unique<ThreadPool>(
54-
init.metric_threads,
55-
init.metric_active_threads,
56-
init.metric_scheduled_threads,
57-
/* max_threads = */ std::numeric_limits<size_t>::max(), // Unlimited number of threads, we do worker management ourselves
58-
/* max_free_threads = */ 0, // We do not require free threads
59-
/* queue_size = */0)) // Unlimited queue to avoid blocking during worker spawning
54+
init.metric_threads,
55+
init.metric_active_threads,
56+
init.metric_scheduled_threads,
57+
/* max_threads = */ ThreadPool::MAX_THEORETICAL_THREAD_COUNT, // Unlimited number of threads, we do worker management ourselves
58+
/* max_free_threads = */ 0, // We do not require free threads
59+
/* queue_size = */ 0)) // Unlimited queue to avoid blocking during worker spawning
6060
{}
6161

6262
AsyncLoader::Pool::Pool(Pool&& o) noexcept

0 commit comments

Comments
 (0)