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

Method run

base/poco/Foundation/src/ThreadPool.cpp:190–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188
189
190void PooledThread::run()
191{
192 DB::ThreadStatus thread_status;
193 if (unlikely(_globalProfilerRealTimePeriodNs != 0 || _globalProfilerCPUTimePeriodNs != 0))
194 thread_status.initGlobalProfiler(_globalProfilerRealTimePeriodNs, _globalProfilerCPUTimePeriodNs);
195
196 _started.set();
197 for (;;)
198 {
199 _targetReady.wait();
200 _mutex.lock();
201 if (_pTarget) // a NULL target means kill yourself
202 {
203 Runnable* pTarget = _pTarget;
204 _mutex.unlock();
205 try
206 {
207 pTarget->run();
208 }
209 catch (Exception& exc)
210 {
211 ErrorHandler::handle(exc);
212 }
213 catch (std::exception& exc)
214 {
215 ErrorHandler::handle(exc);
216 }
217 catch (...)
218 {
219 ErrorHandler::handle();
220 }
221 FastMutex::ScopedLock lock(_mutex);
222 _pTarget = 0;
223 _idleTime = time(NULL);
224 _idle = true;
225 _targetCompleted.set();
226 ThreadLocalStorage::clear();
227 _thread.setName(_name);
228 _thread.setPriority(Thread::PRIO_NORMAL);
229 }
230 else
231 {
232 _mutex.unlock();
233 break;
234 }
235 }
236}
237
238
239ThreadPool::ThreadPool(int minCapacity,

Callers

nothing calls this directly

Calls 9

handleFunction · 0.85
clearFunction · 0.85
initGlobalProfilerMethod · 0.80
setMethod · 0.45
waitMethod · 0.45
lockMethod · 0.45
unlockMethod · 0.45
setNameMethod · 0.45
setPriorityMethod · 0.45

Tested by

no test coverage detected