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

Function PutWork

engine/dlib/src/dlib/jobsystem.cpp:390–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

388
389
390static JobSystemStatus PutWork(JobThreadContext* ctx, HJob job)
391{
392 DM_MUTEX_OPTIONAL_SCOPED_LOCK(ctx->m_Mutex);
393
394 uint32_t generation = ToGeneration(job);
395 uint32_t index = ToIndex(job);
396 JobItem& item = ctx->m_Items.Get(index);
397 assert(item.m_Generation == generation);
398
399 if (item.m_Status != JOBSYSTEM_STATUS_CREATED)
400 return item.m_Status;
401
402 item.m_Status = JOBSYSTEM_STATUS_QUEUED;
403
404 if (ctx->m_Work.Full())
405 ctx->m_Work.OffsetCapacity(16);
406 ctx->m_Work.Push(job);
407
408 return item.m_Status;
409}
410
411static void PutDone(JobThreadContext* ctx, HJob hjob, JobSystemStatus status, int32_t result)
412{

Callers 1

JobSystemPushJobFunction · 0.85

Calls 7

ToGenerationFunction · 0.85
ToIndexFunction · 0.85
assertFunction · 0.50
GetMethod · 0.45
FullMethod · 0.45
OffsetCapacityMethod · 0.45
PushMethod · 0.45

Tested by

no test coverage detected