MCPcopy Create free account
hub / github.com/bloomberg/quantum / universalTaskScheduler

Method universalTaskScheduler

quantum/util/impl/quantum_sequencer_impl.h:453–494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

451template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
452template <class FUNC, class ... ARGS>
453int
454Sequencer<SequenceKey, Hash, KeyEqual, Allocator>::universalTaskScheduler(
455 VoidContextPtr ctx,
456 void* opaque,
457 int queueId,
458 bool isHighPriority,
459 Sequencer& sequencer,
460 FUNC&& func,
461 ARGS&&... args)
462{
463 // construct the dependent collection
464 std::vector<SequenceKeyData> dependents;
465 dependents.reserve(sequencer._contexts.size());
466 for (auto ctxIt = sequencer._contexts.begin(); ctxIt != sequencer._contexts.end(); ++ctxIt)
467 {
468 // check if the context still has a pending task
469 if (isPendingContext(ctx, ctxIt->second._context))
470 {
471 // we will need to wait on this context to finish its current running task
472 dependents.emplace_back(ctxIt->second);
473 }
474 }
475 // update the universal stats only
476 sequencer._universalContext._stats->incrementPostedTaskCount();
477 sequencer._universalContext._stats->incrementPendingTaskCount();
478 // update task stats
479 sequencer._taskStats->incrementPostedTaskCount();
480 sequencer._taskStats->incrementPendingTaskCount();
481
482 // post the task and save the context as the last for the universal sequenceKey
483 sequencer._universalContext._context = ctx->post(
484 std::move(queueId),
485 std::move(isHighPriority),
486 waitForUniversalDependent<FUNC, ARGS...>,
487 std::move(opaque),
488 sequencer,
489 std::move(dependents),
490 SequenceKeyData(sequencer._universalContext),
491 std::forward<FUNC>(func),
492 std::forward<ARGS>(args)...);
493 return 0;
494}
495
496template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
497template <class FUNC, class ... ARGS>

Callers

nothing calls this directly

Calls 6

endMethod · 0.80
SequenceKeyDataClass · 0.70
sizeMethod · 0.45
postMethod · 0.45

Tested by

no test coverage detected