MCPcopy Create free account
hub / github.com/catboost/catboost / DoExecute

Method DoExecute

util/thread/pool.cpp:209–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207 }
208
209 void DoExecute() override {
210 THolder<TTsr> tsr(new TTsr(Parent_));
211
212 if (Namer) {
213 Namer.SetCurrentThreadName();
214 }
215
216 while (true) {
217 IObjectInQueue* job = nullptr;
218
219 with_lock (QueueMutex) {
220 while (Queue.Empty() && !ShouldTerminate.load()) {
221 QueuePushCond.Wait(QueueMutex);
222 }
223
224 if (ShouldTerminate.load() && Queue.Empty()) {
225 tsr.Destroy();
226
227 break;
228 }
229
230 job = Queue.Pop();
231 }
232
233 QueuePopCond.Signal();
234
235 if (Catching) {
236 try {
237 try {
238 job->Process(*tsr);
239 } catch (...) {
240 Cdbg << "[mtp queue] " << CurrentExceptionMessage() << Endl;
241 }
242 } catch (...) {
243 // ¯\_(ツ)_/¯
244 }
245 } else {
246 job->Process(*tsr);
247 }
248 }
249
250 FinishOneThread();
251 }
252
253 inline void FinishOneThread() noexcept {
254 auto guard = Guard(StopMutex);

Callers

nothing calls this directly

Calls 4

CurrentExceptionMessageFunction · 0.85
SetCurrentThreadNameMethod · 0.45
SignalMethod · 0.45
ProcessMethod · 0.45

Tested by

no test coverage detected