Lumiera
0.pre.03
»edit your freedom«
|
A simulated "Lumiera Subsystem".
It is capable of starting a separate thread, which may terminate regularly after a random time, or may fail in various ways. The behaviour is controlled by a number of definitions, given at construction in logic predicate notation.
Definition at line 102 of file subsystem-runner-test.cpp.
Public Member Functions | |
MockSys (Literal id, Literal spec) | |
bool | didRun () const |
operator string () const | |
a human readable name | |
Public Member Functions inherited from Subsys | |
Subsys & | depends (Subsys &prereq) |
define a dependency to another Subsys required for running this subsystem | |
const std::vector< Subsys * > | getPrerequisites () |
bool | isRunning () noexcept |
Private Member Functions | |
bool | checkRunningState () noexcept override |
whether this subsystem is actually operational. More... | |
void | run (Subsys::SigTerm termination) |
executes in a separate thread and simulates a "running" subsystem. More... | |
bool | shouldStart (lumiera::Option &) override |
query application option state to determine if this subsystem should be activated. More... | |
bool | shouldTerminate () |
bool | start (lumiera::Option &, Subsys::SigTerm termination) override |
attempt to bring up this subsystem up. More... | |
void | triggerShutdown () noexcept override |
initiate termination of this subsystem. More... | |
Private Attributes | |
lib::SyncBarrier | barrier_ {} |
atomic_bool | didRun_ {false} |
const string | id_ |
atomic_bool | isUp_ {false} |
int | running_duration_ {0} |
const string | spec_ |
atomic_bool | started_ {false} |
atomic_bool | termRequest_ {false} |
unique_ptr< Thread > | thread_ {} |
Additional Inherited Members | |
Public Types inherited from Subsys | |
typedef function< void(string *)> | SigTerm |
|
inlineoverrideprivatevirtual |
query application option state to determine if this subsystem should be activated.
Implements Subsys.
Definition at line 118 of file subsystem-runner-test.cpp.
|
inlineoverrideprivatevirtual |
attempt to bring up this subsystem up.
On return, the subsystem must be operational, according to checkRunningState(). Failure to start up usually terminates the whole application. When this subsystem ceases to work, it must ensure to activate the given callback signal.
options | may be influencing the operation mode |
SigTerm | to be signalled by the subsystem. |
true
if actually started. Implements Subsys.
Definition at line 128 of file subsystem-runner-test.cpp.
References cStr().
|
inlineoverrideprivatevirtualnoexcept |
initiate termination of this subsystem.
This trigger may be called repeatedly any time... When the subsystem actually has terminated, the SigTerm passed to start must be invoked.
Implements Subsys.
Definition at line 156 of file subsystem-runner-test.cpp.
References cStr().
|
inlineoverrideprivatevirtualnoexcept |
whether this subsystem is actually operational.
When returning false
here, the application may terminate at any point without further notice Note further, that a subsystem must not be in running state when signalling termination.
Implements Subsys.
Definition at line 165 of file subsystem-runner-test.cpp.
|
inlineprivate |
executes in a separate thread and simulates a "running" subsystem.
Behaviour determined by run(XX) spec:
Definition at line 181 of file subsystem-runner-test.cpp.