| 544 | |
| 545 | #if defined(DM_HAS_THREADS) |
| 546 | static void JobThread(void* _ctx) |
| 547 | { |
| 548 | JobThreadContext* ctx = (JobThreadContext*)_ctx; |
| 549 | while (true) |
| 550 | { |
| 551 | HJob hjob = 0; |
| 552 | { |
| 553 | DM_MUTEX_SCOPED_LOCK(ctx->m_Mutex); |
| 554 | |
| 555 | if (!ctx->m_Run) |
| 556 | break; |
| 557 | |
| 558 | while(ctx->m_Work.Empty()) |
| 559 | { |
| 560 | dmConditionVariable::Wait(ctx->m_WakeupCond, ctx->m_Mutex); |
| 561 | if (!ctx->m_Run) |
| 562 | return; |
| 563 | } |
| 564 | |
| 565 | uint64_t time = dmTime::GetMonotonicTime(); |
| 566 | JobItem* item = 0; |
| 567 | hjob = SelectAndPopJob(ctx, time, &item); |
| 568 | if (hjob == INVALID_JOB) |
| 569 | continue; |
| 570 | } |
| 571 | |
| 572 | { |
| 573 | DM_PROFILE("JobThreadProcess"); |
| 574 | ProcessOneJob(ctx, hjob); |
| 575 | } |
| 576 | } |
| 577 | } |
| 578 | #endif |
| 579 | |
| 580 | static void ProcessFinishedJobs(HJobContext context, jc::RingBuffer<HJob>& items) |
nothing calls this directly
no test coverage detected