| 451 | template <class SequenceKey, class Hash, class KeyEqual, class Allocator> |
| 452 | template <class FUNC, class ... ARGS> |
| 453 | int |
| 454 | Sequencer<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 | |
| 496 | template <class SequenceKey, class Hash, class KeyEqual, class Allocator> |
| 497 | template <class FUNC, class ... ARGS> |
nothing calls this directly
no test coverage detected