| 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); |
nothing calls this directly
no test coverage detected