![]() |
Lumiera 0.pre.04
»edit your freedom«
|
#include "steam/control/looper.hpp"
Encapsulated control logic for the session thread loop.
This helper component was factored out from the loop body for sake of clarity and to allow unit testing of the logic in isolation. It is based on logical relations together with the following assumptions
while conditionDefinition at line 105 of file looper.hpp.
Public Member Functions | |
| template<class FUN > | |
| Looper (FUN determine_commands_are_waiting) | |
| bool | isDying () const |
| bool | isDisabled () const |
| bool | useTimeout () const |
| bool | isWorking () const |
| bool | idleBuild () const |
| bool | runBuild () const |
| bool | isIdle () const |
| void | triggerShutdown () |
| void | enableProcessing (bool yes=true) |
| void | markStateProcessed () |
| invoking this function signals that all consequences of past state changes have been processed and are duly resolved. | |
| bool | hasPendingChanges () const |
| < "check point" | |
| bool | requireAction () |
| state fusion to control (timed) wait | |
| bool | shallLoop () const |
| state fusion to control looping | |
| milliseconds | getTimeout () const |
Private Types | |
| using | Predicate = std::function< bool(void)> |
Private Member Functions | |
| void | startBuilderTimeout () |
| bool | forceBuild () const |
Static Private Member Functions | |
| static uint | wakeTimeout_ms () |
| static uint | slowdownFactor () |
Private Attributes | |
| bool | shutdown_ = false |
| bool | disabled_ = false |
| bool | inChange_ = false |
| bool | hasWork_ = false |
| bool | isDirty_ = false |
| TimeVar | gotDirty_ = Time::NEVER |
| Predicate | hasCommandsPending_ |
Definition at line 122 of file looper.hpp.
|
inline |
Definition at line 131 of file looper.hpp.
References Looper::shutdown_.
Referenced by Looper::isDisabled(), Looper::requireAction(), DispatcherLoop::runSessionThread(), and Looper::shallLoop().
Here is the caller graph for this function:
|
inline |
Definition at line 132 of file looper.hpp.
References Looper::disabled_, and Looper::isDying().
Referenced by Looper::isIdle(), Looper::isWorking(), Looper::runBuild(), DispatcherLoop::updateState(), and Looper::useTimeout().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Definition at line 133 of file looper.hpp.
References Looper::isDirty_, and Looper::isDisabled().
Referenced by Looper::getTimeout(), and Looper::requireAction().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Definition at line 134 of file looper.hpp.
References Looper::hasWork_, and Looper::isDisabled().
Referenced by Looper::getTimeout(), Looper::isIdle(), Looper::requireAction(), and DispatcherLoop::runSessionThread().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Definition at line 135 of file looper.hpp.
References Looper::hasWork_, and Looper::isDirty_.
Referenced by Looper::runBuild().
Here is the caller graph for this function:
|
inline |
Definition at line 136 of file looper.hpp.
References Looper::forceBuild(), Looper::idleBuild(), and Looper::isDisabled().
Referenced by Looper::isIdle(), Looper::markStateProcessed(), and DispatcherLoop::runSessionThread().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Definition at line 137 of file looper.hpp.
References Looper::isDisabled(), Looper::isWorking(), and Looper::runBuild().
Here is the call graph for this function:
|
inline |
Definition at line 143 of file looper.hpp.
References Looper::shutdown_.
Referenced by DispatcherLoop::requestStop().
Here is the caller graph for this function:Definition at line 149 of file looper.hpp.
References Looper::disabled_.
Referenced by DispatcherLoop::activateCommandProecssing(), and DispatcherLoop::deactivateCommandProecssing().
Here is the caller graph for this function:
|
inline |
invoking this function signals that all consequences of past state changes have been processed and are duly resolved.
Definition at line 165 of file looper.hpp.
References Looper::inChange_, Looper::isDirty_, and Looper::runBuild().
Referenced by DispatcherLoop::updateState().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
< "check point"
Definition at line 173 of file looper.hpp.
References Looper::inChange_.
Referenced by DispatcherLoop::isStateSynched().
Here is the caller graph for this function:
|
inline |
state fusion to control (timed) wait
Definition at line 180 of file looper.hpp.
References Looper::forceBuild(), Looper::hasCommandsPending_, Looper::hasWork_, Looper::inChange_, Looper::isDirty_, Looper::isDying(), Looper::isWorking(), Looper::startBuilderTimeout(), and Looper::useTimeout().
Here is the call graph for this function:
|
inline |
state fusion to control looping
Definition at line 197 of file looper.hpp.
References Looper::isDying().
Referenced by DispatcherLoop::runSessionThread().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Definition at line 203 of file looper.hpp.
References Looper::isDirty_, Looper::isWorking(), Looper::slowdownFactor(), Looper::useTimeout(), and Looper::wakeTimeout_ms().
Referenced by DispatcherLoop::awaitAction().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinestaticprivate |
establish the typical timeout for idle sleep. When the SteamDispatcher has no work to do, it needs to wake up regularly for a checkpoint, to determine if the Builder needs to be triggered or the shutdown-flag be checked. So the period established here defines some kind of minimal reaction especially for the builder, so to ensure that further commands trickling in get a chance to be enqueued before the builder run effectively blocks command processing. Add to this the typical average running time of the builder, to get the reaction period visible to the user as update response delay within the UI.
Definition at line 236 of file looper.hpp.
Referenced by Looper::forceBuild(), and Looper::getTimeout().
Here is the caller graph for this function:
|
inlinestaticprivate |
Definition at line 242 of file looper.hpp.
Referenced by Looper::forceBuild(), and Looper::getTimeout().
Here is the caller graph for this function:
|
inlineprivate |
Definition at line 248 of file looper.hpp.
References Looper::gotDirty_, and RealClock::now().
Referenced by Looper::requireAction().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineprivate |
logic to enforce a builder run, once some extended time period has been passed.
Definition at line 257 of file looper.hpp.
References Looper::gotDirty_, Looper::isDirty_, RealClock::now(), Looper::slowdownFactor(), and Looper::wakeTimeout_ms().
Referenced by Looper::requireAction(), and Looper::runBuild().
Here is the call graph for this function:
Here is the caller graph for this function:Definition at line 109 of file looper.hpp.
Referenced by Looper::isDying(), and Looper::triggerShutdown().
Definition at line 110 of file looper.hpp.
Referenced by Looper::enableProcessing(), and Looper::isDisabled().
Definition at line 111 of file looper.hpp.
Referenced by Looper::hasPendingChanges(), Looper::markStateProcessed(), and Looper::requireAction().
Definition at line 112 of file looper.hpp.
Referenced by Looper::idleBuild(), Looper::isWorking(), and Looper::requireAction().
Definition at line 113 of file looper.hpp.
Referenced by Looper::forceBuild(), Looper::getTimeout(), Looper::idleBuild(), Looper::markStateProcessed(), Looper::requireAction(), and Looper::useTimeout().
|
private |
Definition at line 115 of file looper.hpp.
Referenced by Looper::forceBuild(), and Looper::startBuilderTimeout().
|
private |
Definition at line 117 of file looper.hpp.
Referenced by Looper::requireAction().
Collaboration diagram for Looper: