| 274 | } |
| 275 | |
| 276 | void NPar::TLocalExecutor::ExecRange(TIntrusivePtr<ILocallyExecutable> exec, int firstId, int lastId, int flags) { |
| 277 | Y_ASSERT(lastId >= firstId); |
| 278 | if (TryExecRangeSequentially([=] (int id) { exec->LocalExec(id); }, firstId, lastId, flags)) { |
| 279 | return; |
| 280 | } |
| 281 | auto rangeExec = MakeIntrusive<TLocalRangeExecutor>(std::move(exec), firstId, lastId); |
| 282 | int queueSizeLimit = (flags & WAIT_COMPLETE) ? 10000 : -1; |
| 283 | int prior = Max<int>(Impl_->CurrentTaskPriority, flags & PRIORITY_MASK); |
| 284 | switch (prior) { |
| 285 | case HIGH_PRIORITY: |
| 286 | Impl_->LaunchRange(rangeExec, queueSizeLimit, &Impl_->QueueSize, &Impl_->JobQueue); |
| 287 | break; |
| 288 | case MED_PRIORITY: |
| 289 | Impl_->LaunchRange(rangeExec, queueSizeLimit, &Impl_->MPQueueSize, &Impl_->MedJobQueue); |
| 290 | break; |
| 291 | case LOW_PRIORITY: |
| 292 | Impl_->LaunchRange(rangeExec, queueSizeLimit, &Impl_->LPQueueSize, &Impl_->LowJobQueue); |
| 293 | break; |
| 294 | default: |
| 295 | Y_ASSERT(0); |
| 296 | break; |
| 297 | } |
| 298 | if (flags & WAIT_COMPLETE) { |
| 299 | int keepPrior = Impl_->CurrentTaskPriority; |
| 300 | Impl_->CurrentTaskPriority = prior; |
| 301 | while (rangeExec->DoSingleOp()) { |
| 302 | } |
| 303 | Impl_->CurrentTaskPriority = keepPrior; |
| 304 | rangeExec->WaitComplete(); |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | void NPar::ILocalExecutor::ExecRange(TLocallyExecutableFunction exec, int firstId, int lastId, int flags) { |
| 309 | if (TryExecRangeSequentially(exec, firstId, lastId, flags)) { |
no test coverage detected