MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / setMaxFreeThreads

Method setMaxFreeThreads

src/Common/ThreadPool.cpp:243–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241
242template <typename Thread>
243void ThreadPoolImpl<Thread>::setMaxFreeThreads(size_t value)
244{
245 value = std::min(value, static_cast<size_t>(MAX_THEORETICAL_THREAD_COUNT));
246 std::lock_guard lock(mutex);
247 bool need_finish_free_threads = (value < max_free_threads);
248
249 max_free_threads = std::min(value, max_threads);
250
251 if (need_finish_free_threads)
252 {
253 /// Wake exactly the excess idle threads so they can observe the new limit
254 /// and exit. We do not call `wakeUpAllIdleThreadsNoLock` here because that
255 /// would wipe the LIFO stack on every limit adjustment, defeating the
256 /// purpose of LIFO scheduling.
257 wakeUpExcessIdleThreadsNoLock();
258 }
259}
260
261template <typename Thread>
262void ThreadPoolImpl<Thread>::setQueueSize(size_t value)

Callers 4

reloadConfigurationMethod · 0.80
TESTFunction · 0.80

Calls 1

minFunction · 0.50

Tested by 1

TESTFunction · 0.64