Good for unit testing with/without threads enabled
| 522 | |
| 523 | // Good for unit testing with/without threads enabled |
| 524 | static void UpdateSingleThread(JobThreadContext* ctx, uint64_t max_time) |
| 525 | { |
| 526 | uint64_t tstart = dmTime::GetMonotonicTime(); |
| 527 | while (!ctx->m_Work.Empty()) |
| 528 | { |
| 529 | DM_MUTEX_OPTIONAL_SCOPED_LOCK(ctx->m_Mutex); |
| 530 | JobItem* item = 0; |
| 531 | HJob hjob = SelectAndPopJob(ctx, tstart, &item); |
| 532 | if (hjob == INVALID_JOB) |
| 533 | return; // we had no valid job this frame |
| 534 | |
| 535 | ProcessOneJob(ctx, hjob); |
| 536 | |
| 537 | uint64_t tend = dmTime::GetMonotonicTime(); |
| 538 | if (max_time == 0 || (tend-tstart) > max_time) |
| 539 | { |
| 540 | break; |
| 541 | } |
| 542 | } |
| 543 | } |
| 544 | |
| 545 | #if defined(DM_HAS_THREADS) |
| 546 | static void JobThread(void* _ctx) |
no test coverage detected