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

Method try_cancel

modules/engine/runtime/src/io/common/io_runner.cpp:205–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203}
204
205bool RunnerBase::try_cancel(SkrAsyncServicePriority priority, IORequestId rq) SKR_NOEXCEPT
206{
207 if (auto pComp = io_component<IOStatusComponent>(rq.get()))
208 {
209 const auto status = pComp->getStatus();
210 if (status == SKR_IO_STAGE_CANCELLED) return true;
211 if (status == SKR_IO_STAGE_LOADING) return false;
212
213 if (bool cancel_requested = pComp->getCancelRequested())
214 {
215 if (pComp->getFinishStep() == SKR_ASYNC_IO_FINISH_STEP_NONE)
216 {
217 if (pComp->is_async_cancel())
218 {
219 auto cancel = [this, priority, rq = rq.get()] { return cancel_(rq, priority); };
220 finish_futures.emplace_back(skr::FutureLauncher<bool>(job_queue).async(cancel), rq);
221 }
222 else
223 {
224 cancel_(rq.get(), priority);
225 }
226 }
227 // remove from batch
228 if (auto batch = static_cast<IOBatchBase*>(pComp->getOwnerBatch()))
229 batch->removeCancelledRequest(rq);
230 else
231 SKR_UNREACHABLE_CODE();
232 return true;
233 }
234 }
235 return false;
236}
237
238void RunnerBase::dispatch_complete_(SkrAsyncServicePriority priority, IORequestId rq) SKR_NOEXCEPT
239{

Callers 5

addRAMRequestsMethod · 0.80
enqueueAndSubmitMethod · 0.80
dispatchMethod · 0.80
dispatchFunctionMethod · 0.80
enqueueAndSubmitMethod · 0.80

Calls 4

getStatusMethod · 0.80
getMethod · 0.45
emplace_backMethod · 0.45
asyncMethod · 0.45

Tested by

no test coverage detected