Lumiera  0.pre.03
»edit your freedom«
looper.hpp File Reference

Go to the source code of this file.

Description

Implementation building block of SteamDispatcher to control waiting and timing.

This helper encapsulates the loop control logic to separate it from actual implementation of timing and waiting (per pthread condition variables). It exposes a combined condition (to be used for waiting) plus any further state predicates necessary to manage the state transitions regarding the SteamDispatcher implementation:

  • detect working state, based on a closure to detect an non empty CommandQueue
  • handle the disabling and shutdown of the dispatching task
  • detect an idle state to allow the DispatcherLoop to go to sleep
  • detect the need to run the builder after handling a command
  • manage timeout to run the builder with a slight latency
  • manage an extended timeout to enforce builder run eventually.
  • offer a "check point" where all state is balanced, which can be used as a synchronisation point to halt the loop.
See also
DispatcherLooper_test
steam-dispatcher.hpp
DispatcherLoop
CommandQueue

Definition in file looper.hpp.

#include "lib/time/timevalue.hpp"
#include "vault/real-clock.hpp"
#include <functional>
#include <chrono>

Classes

class  Looper
 Encapsulated control logic for the session thread loop. More...
 

Variables

const uint STEAM_DISPATCHER_BUILDER_DELAY_ms = 50
 Latency to trigger the Builder after processing command(s). More...
 
const uint STEAM_DISPATCHER_BUSY_SLOWDOWN_FACTOR = 15
 Factor to slow down the latency when the command queue is not empty. More...
 

Namespaces

 steam
 Steam-Layer implementation namespace root.
 
 steam::control
 Steam-Layer dispatcher, controller and administrative facilities.