From 479f4170c27a20e945b7d61ad68de3553dd3d00a Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Wed, 14 Dec 2016 04:57:08 +0100 Subject: [PATCH] implement activated state need to keep state variables on both levels, since the session manager (lifecycle) "opens" the session for external access by starting the dispatcher; it may well happen thus that the session starts up, while the *session subsystem* is not(yet) started --- src/proc/control/proc-dispatcher.cpp | 48 +++++++++++++++++++++----- src/proc/control/proc-dispatcher.hpp | 1 + wiki/thinkPad.ichthyo.mm | 50 +++++++++++++++++++++++++--- 3 files changed, 87 insertions(+), 12 deletions(-) diff --git a/src/proc/control/proc-dispatcher.cpp b/src/proc/control/proc-dispatcher.cpp index 1fa17cd7b..83b8d82c6 100644 --- a/src/proc/control/proc-dispatcher.cpp +++ b/src/proc/control/proc-dispatcher.cpp @@ -45,6 +45,9 @@ namespace control { : ThreadJoinable , public Sync { + bool canDispatch_{false}; + bool blocked_ {false}; + public: DispatcherLoop (Subsys::SigTerm notification) : ThreadJoinable("Lumiera Session" @@ -58,7 +61,25 @@ namespace control { this->join(); INFO (session, "Proc-Dispatcher stopped."); } - + + void + activateCommandProecssing() + { + Lock sync(this); + canDispatch_ = true; + INFO (command, "Session command processing activated."); + TODO ("implement command processing queue"); + } + + void + deactivateCommandProecssing() + { + Lock sync(this); + canDispatch_ = false; + INFO (command, "Session command interface closed."); + TODO ("implement command processing queue"); + } + private: void run (Subsys::SigTerm sigTerm) @@ -106,7 +127,9 @@ namespace control { runningLoop_.reset(); termNotification(problemMessage); })); - + + if (active_) + runningLoop_->activateCommandProecssing(); return true; } @@ -129,13 +152,21 @@ namespace control { } - /** */ + /** activate processing of enqueued session commands. + * @remarks command processing serves as public external interface + * to the session. This call is used by the session lifecycle (SessManagerImpl) + * when the session is brought up; any other invocation runs danger to mess up + * the session lifecycle state and process commands on a deconfigured session. + * In case the dispatcher loop is not actually running, the activation state + * is stored and applied accordingly later, when the loop is fired up. + */ void ProcDispatcher::activate() { Lock sync(this); - INFO (command, "Session command processing activated."); ///////////////TODO only emit these log messages when processing is *really* started/stopped - TODO ("implement command processing queue"); + active_ = true; + if (runningLoop_) + runningLoop_->activateCommandProecssing(); } @@ -143,8 +174,9 @@ namespace control { ProcDispatcher::deactivate() { Lock sync(this); - INFO (command, "Session command interface closed."); - TODO ("implement command processing queue"); + active_ = false; + if (runningLoop_) + runningLoop_->deactivateCommandProecssing(); } @@ -152,7 +184,7 @@ namespace control { ProcDispatcher::clear() { Lock sync(this); - if (!empty()) + if (not empty()) WARN (command, "DISCARDING pending Session commands."); TODO ("implement command processing queue"); } diff --git a/src/proc/control/proc-dispatcher.hpp b/src/proc/control/proc-dispatcher.hpp index 95b485eff..0e117946d 100644 --- a/src/proc/control/proc-dispatcher.hpp +++ b/src/proc/control/proc-dispatcher.hpp @@ -64,6 +64,7 @@ namespace control { : public lib::Sync<> { unique_ptr runningLoop_; + bool active_{false}; public: diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 6aeaf4fa1..50b6f71d0 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -222,8 +222,7 @@ - - + @@ -257,13 +256,56 @@ - - + + + + + + + + + + + + + + + + +

+ ...wenn jemand zugreift +

+ + +
+
+ + + + + + +

+ grundlegende Design-Enscheidung +

+
    +
  • + wir haben Komponenten mit Dependency-Injection +
  • +
  • + da beide Komponenten nur nach ihren eigenen Hinsichten funktionieren,
    wird das System insgesamt einfacher +
  • +
+ + +
+ +