| 703 | } |
| 704 | |
| 705 | void JobSystemUpdate(HJobContext context, uint64_t time_limit) |
| 706 | { |
| 707 | DM_PROFILE("JobThreadUpdate"); |
| 708 | |
| 709 | if (!context->m_UseThreads) |
| 710 | { |
| 711 | UpdateSingleThread(&context->m_ThreadContext, time_limit); |
| 712 | } |
| 713 | |
| 714 | // Lock for as little as possible, by copying the items to an array owned by this thread |
| 715 | jc::RingBuffer<HJob> items; |
| 716 | |
| 717 | { |
| 718 | DM_MUTEX_OPTIONAL_SCOPED_LOCK(context->m_ThreadContext.m_Mutex); |
| 719 | items.Swap(context->m_ThreadContext.m_Done); |
| 720 | } |
| 721 | |
| 722 | // Now do the callbacks |
| 723 | ProcessFinishedJobs(context, items); |
| 724 | } |
| 725 | static void DebugPrintJob(JobThreadContext* ctx, HJob hjob) |
| 726 | { |
| 727 | uint32_t generation = ToGeneration(hjob); |