MCPcopy Create free account
hub / github.com/defold/defold / UpdateSingleThread

Function UpdateSingleThread

engine/dlib/src/dlib/jobsystem.cpp:524–543  ·  view source on GitHub ↗

Good for unit testing with/without threads enabled

Source from the content-addressed store, hash-verified

522
523// Good for unit testing with/without threads enabled
524static 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)
546static void JobThread(void* _ctx)

Callers 1

JobSystemUpdateFunction · 0.85

Calls 4

SelectAndPopJobFunction · 0.85
ProcessOneJobFunction · 0.85
GetMonotonicTimeFunction · 0.70
EmptyMethod · 0.45

Tested by

no test coverage detected