Lumiera
0.pre.03
»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) | |
void | enableProcessing (bool yes=true) |
milliseconds | getTimeout () const |
bool | hasPendingChanges () const |
< "check point" | |
bool | idleBuild () const |
bool | isDisabled () const |
bool | isDying () const |
bool | isIdle () const |
bool | isWorking () const |
void | markStateProcessed () |
invoking this function signals that all consequences of past state changes have been processed and are duly resolved. More... | |
bool | requireAction () |
state fusion to control (timed) wait | |
bool | runBuild () const |
bool | shallLoop () const |
state fusion to control looping | |
void | triggerShutdown () |
bool | useTimeout () const |
Private Types | |
using | Predicate = std::function< bool(void)> |
Private Member Functions | |
bool | forceBuild () const |
void | startBuilderTimeout () |
Static Private Member Functions | |
static uint | slowdownFactor () |
static uint | wakeTimeout_ms () |
Private Attributes | |
bool | disabled_ = false |
TimeVar | gotDirty_ = Time::NEVER |
Predicate | hasCommandsPending_ |
bool | hasWork_ = false |
bool | inChange_ = false |
bool | isDirty_ = false |
bool | shutdown_ = false |
|
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.
Referenced by DispatcherLoop::runSessionThread(), and DispatcherLooper_test::verifyBuilderStart().
|
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.
References steam::control::anonymous_namespace{looper.hpp}::STEAM_DISPATCHER_BUILDER_DELAY_ms, and steam::control::anonymous_namespace{looper.hpp}::STEAM_DISPATCHER_BUSY_SLOWDOWN_FACTOR.
Referenced by Looper::shallLoop().
|
inlineprivate |
logic to enforce a builder run, once some extended time period has been passed.
Definition at line 257 of file looper.hpp.
Referenced by Looper::requireAction(), and Looper::shallLoop().