MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / run

Method run

modules/core/core/src/async/job.cpp:149–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147};
148
149JobResult JobThreadFunctionImpl::run() SKR_NOEXCEPT
150{
151 bool isEndJobArrived = false;
152 while (false == isEndJobArrived)
153 {
154 m_item = m_queue->getRunnableJobItem();
155
156 if (m_item)
157 {
158 const auto itemStatus = skr_atomic32_load_acquire(&m_item->status);
159 SKR_ASSERT((itemStatus == kJobItemStatusRunning) || (itemStatus == kJobItemStatusFinishJob));
160
161 // exit the loop when the end job is arrived
162 isEndJobArrived = (itemStatus == kJobItemStatusFinishJob);
163
164 m_item->result = m_item->run();
165
166 // delete the JobItem which has been executed
167 m_queue->erase(m_item);
168 m_item = nullptr;
169 }
170 }
171 return ASYNC_RESULT_OK;
172}
173
174JobItem::JobItem(const char8_t* name, const JobItemDesc& desc) SKR_NOEXCEPT
175 : status(kJobItemStatusNone), name(name)

Callers 6

OpenProjectMethod · 0.45
on_loadFunction · 0.45
InitializeAsyncWorkerMethod · 0.45
threadFuncMethod · 0.45
initMethod · 0.45
initMethod · 0.45

Calls 3

getRunnableJobItemMethod · 0.80
eraseMethod · 0.45

Tested by

no test coverage detected