Lumiera
0.pre.03
»edit your freedom«
|
#include "vault/gear/scheduler-commutator.hpp"
Scheduler Layer-2 : execution of Scheduler Activities.
Definition at line 109 of file scheduler-commutator.hpp.
Public Member Functions | |
bool | acquireGoomingToken () noexcept |
acquire the right to perform internal state transitions. More... | |
template<class DISPATCH , class CLOCK > | |
activity::Proc | dispatchCapacity (SchedulerInvocation &, LoadController &, DISPATCH, CLOCK) |
Implementation of the worker-Functor: More... | |
void | dropGroomingToken () noexcept |
relinquish the right for internal state transitions. More... | |
ActivationEvent | findWork (SchedulerInvocation &layer1, Time now) |
Look into the queues and possibly retrieve work due by now. More... | |
bool | holdsGroomingToken (ThreadID id) noexcept |
check if the indicated thread currently holds the right to conduct internal state transitions. | |
bool | maintainQueueHead (SchedulerInvocation &layer1, Time now) |
update queue head to discard obsolete content. More... | |
void | maybeFeed (SchedulerInvocation &layer1) |
tend to the input queue if possible | |
activity::Proc | postChain (ActivationEvent event, SchedulerInvocation &layer1) |
This is the primary entrance point to the Scheduler. More... | |
ScopedGroomingGuard | requireGroomingTokenHere () |
a scope guard to force acquisition of the GroomingToken More... | |
Classes | |
class | ScopedGroomingGuard |
struct | WorkerInstruction |
monad-like step sequence: perform sequence of steps, as long as the result remains activity::PASS More... | |
Private Types | |
using | ThreadID = std::thread::id |
Private Member Functions | |
void | ensureDroppedGroomingToken () |
activity::Proc | scatteredDelay (Time now, Time head, LoadController &loadController, LoadController::Capacity capacity) |
A worker asking for work constitutes free capacity, which can be redirected into a focused zone of the scheduler time axis where it is most likely to be useful, unless there is active work to be carried out right away. More... | |
Private Member Functions inherited from NonCopyable | |
NonCopyable (NonCopyable const &)=delete | |
NonCopyable & | operator= (NonCopyable const &)=delete |
Private Attributes | |
atomic< ThreadID > | groomingToken_ {} |
|
inlinenoexcept |
acquire the right to perform internal state transitions.
true
if this attempt succeeded Definition at line 128 of file scheduler-commutator.hpp.
References vault::gear::anonymous_namespace{scheduler-commutator.hpp}::thisThread().
Referenced by SchedulerCommutator_test::___ensureGroomingTokenReleased(), SchedulerCommutator_test::blockGroomingToken(), SchedulerCommutator::findWork(), SchedulerCommutator::maybeFeed(), SchedulerCommutator::scatteredDelay(), and SchedulerCommutator_test::verify_postChain().
|
inlinenoexcept |
relinquish the right for internal state transitions.
Definition at line 144 of file scheduler-commutator.hpp.
References vault::gear::anonymous_namespace{scheduler-commutator.hpp}::thisThread().
Referenced by SchedulerCommutator_test::___ensureGroomingTokenReleased(), SchedulerCommutator_test::blockGroomingToken(), SchedulerCommutator_test::integratedWorkCycle(), SchedulerCommutator::postChain(), SchedulerCommutator::ScopedGroomingGuard::ScopedGroomingGuard(), SchedulerCommutator_test::verify_postChain(), and Scheduler::ExecutionCtx::work().
|
inline |
a scope guard to force acquisition of the GroomingToken
Definition at line 464 of file scheduler-commutator.hpp.
Referenced by Scheduler::handleDutyCycle(), SchedulerCommutator::holdsGroomingToken(), Scheduler::seedCalcStream(), and SchedulerCommutator_test::verify_GroomingGuard().
|
inline |
update queue head to discard obsolete content.
now | current time to use for decision about dropping tasks |
false
when failing to establish a consistent state due to missed compulsory entries; should cause Emergency halt. Definition at line 184 of file scheduler-commutator.hpp.
References SchedulerInvocation::feedPrioritisation(), SchedulerCommutator::holdsGroomingToken(), SchedulerInvocation::isOutdated(), SchedulerInvocation::isOutOfTime(), SchedulerInvocation::pullHead(), and vault::gear::anonymous_namespace{scheduler-commutator.hpp}::thisThread().
Referenced by SchedulerCommutator::findWork(), and Scheduler::handleDutyCycle().
|
inline |
Look into the queues and possibly retrieve work due by now.
Definition at line 199 of file scheduler-commutator.hpp.
References SchedulerCommutator::acquireGoomingToken(), SchedulerInvocation::feedPrioritisation(), SchedulerCommutator::holdsGroomingToken(), SchedulerInvocation::isOutdated(), SchedulerInvocation::isOutOfTime(), SchedulerCommutator::maintainQueueHead(), SchedulerInvocation::pullHead(), and vault::gear::anonymous_namespace{scheduler-commutator.hpp}::thisThread().
Referenced by SchedulerCommutator_test::demonstrateSimpleUsage(), SchedulerCommutator::dispatchCapacity(), SchedulerCommutator_test::integratedWorkCycle(), SchedulerCommutator_test::verify_findWork(), SchedulerCommutator_test::verify_postChain(), and SchedulerCommutator_test::verify_Significance().
|
inline |
This is the primary entrance point to the Scheduler.
Place the given event into the schedule, with prioritisation according to its start time.
event | the chain of Render Activities to be scheduled, including start time and deadline |
Definition at line 233 of file scheduler-commutator.hpp.
References SchedulerCommutator::dispatchCapacity(), SchedulerCommutator::dropGroomingToken(), SchedulerInvocation::feedPrioritisation(), SchedulerCommutator::holdsGroomingToken(), SchedulerInvocation::instruct(), SchedulerCommutator::scatteredDelay(), and vault::gear::anonymous_namespace{scheduler-commutator.hpp}::thisThread().
Referenced by Scheduler::handleDutyCycle(), SchedulerCommutator_test::integratedWorkCycle(), Scheduler::ExecutionCtx::post(), Scheduler::postChain(), and SchedulerCommutator_test::verify_postChain().
|
inline |
Implementation of the worker-Functor:
Definition at line 320 of file scheduler-commutator.hpp.
References SchedulerCommutator::findWork(), SchedulerInvocation::headTime(), LoadController::markIncomingCapacity(), LoadController::markOutgoingCapacity(), SchedulerCommutator::maybeFeed(), and SchedulerCommutator::scatteredDelay().
Referenced by Scheduler::doWork(), SchedulerCommutator::postChain(), and SchedulerCommutator_test::verify_dispatch().
|
inlineprivate |
A worker asking for work constitutes free capacity, which can be redirected into a focused zone of the scheduler time axis where it is most likely to be useful, unless there is active work to be carried out right away.
capacity | classification of the capacity to employ this thread |
Definition at line 377 of file scheduler-commutator.hpp.
References SchedulerCommutator::acquireGoomingToken(), LoadController::DISPATCH, SchedulerCommutator::holdsGroomingToken(), LoadController::IDLEWAIT, LoadController::scatteredDelayTime(), LoadController::SPINTIME, LoadController::tendedNext(), LoadController::tendNext(), LoadController::TENDNEXT, and vault::gear::anonymous_namespace{scheduler-commutator.hpp}::thisThread().
Referenced by SchedulerCommutator::dispatchCapacity(), and SchedulerCommutator::postChain().