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
This commit is contained in:
parent
a853851447
commit
479f4170c2
3 changed files with 87 additions and 12 deletions
|
|
@ -45,6 +45,9 @@ namespace control {
|
||||||
: ThreadJoinable
|
: ThreadJoinable
|
||||||
, public Sync<RecursiveLock_Waitable>
|
, public Sync<RecursiveLock_Waitable>
|
||||||
{
|
{
|
||||||
|
bool canDispatch_{false};
|
||||||
|
bool blocked_ {false};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DispatcherLoop (Subsys::SigTerm notification)
|
DispatcherLoop (Subsys::SigTerm notification)
|
||||||
: ThreadJoinable("Lumiera Session"
|
: ThreadJoinable("Lumiera Session"
|
||||||
|
|
@ -59,6 +62,24 @@ namespace control {
|
||||||
INFO (session, "Proc-Dispatcher stopped.");
|
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:
|
private:
|
||||||
void
|
void
|
||||||
run (Subsys::SigTerm sigTerm)
|
run (Subsys::SigTerm sigTerm)
|
||||||
|
|
@ -107,6 +128,8 @@ namespace control {
|
||||||
termNotification(problemMessage);
|
termNotification(problemMessage);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
if (active_)
|
||||||
|
runningLoop_->activateCommandProecssing();
|
||||||
return true;
|
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
|
void
|
||||||
ProcDispatcher::activate()
|
ProcDispatcher::activate()
|
||||||
{
|
{
|
||||||
Lock sync(this);
|
Lock sync(this);
|
||||||
INFO (command, "Session command processing activated."); ///////////////TODO only emit these log messages when processing is *really* started/stopped
|
active_ = true;
|
||||||
TODO ("implement command processing queue");
|
if (runningLoop_)
|
||||||
|
runningLoop_->activateCommandProecssing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -143,8 +174,9 @@ namespace control {
|
||||||
ProcDispatcher::deactivate()
|
ProcDispatcher::deactivate()
|
||||||
{
|
{
|
||||||
Lock sync(this);
|
Lock sync(this);
|
||||||
INFO (command, "Session command interface closed.");
|
active_ = false;
|
||||||
TODO ("implement command processing queue");
|
if (runningLoop_)
|
||||||
|
runningLoop_->deactivateCommandProecssing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -152,7 +184,7 @@ namespace control {
|
||||||
ProcDispatcher::clear()
|
ProcDispatcher::clear()
|
||||||
{
|
{
|
||||||
Lock sync(this);
|
Lock sync(this);
|
||||||
if (!empty())
|
if (not empty())
|
||||||
WARN (command, "DISCARDING pending Session commands.");
|
WARN (command, "DISCARDING pending Session commands.");
|
||||||
TODO ("implement command processing queue");
|
TODO ("implement command processing queue");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ namespace control {
|
||||||
: public lib::Sync<>
|
: public lib::Sync<>
|
||||||
{
|
{
|
||||||
unique_ptr<DispatcherLoop> runningLoop_;
|
unique_ptr<DispatcherLoop> runningLoop_;
|
||||||
|
bool active_{false};
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -222,8 +222,7 @@
|
||||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1481509921211" ID="ID_1515469097" MODIFIED="1481599502388" TEXT="TODO: Session-Subsystem implementieren (#318)">
|
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1481509921211" ID="ID_1515469097" MODIFIED="1481599502388" TEXT="TODO: Session-Subsystem implementieren (#318)">
|
||||||
<icon BUILTIN="pencil"/>
|
<icon BUILTIN="pencil"/>
|
||||||
<node CREATED="1481599413419" ID="ID_673133356" MODIFIED="1481599420290" TEXT="Ticket #318"/>
|
<node CREATED="1481599413419" ID="ID_673133356" MODIFIED="1481599420290" TEXT="Ticket #318"/>
|
||||||
<node CREATED="1481599421021" ID="ID_461768132" MODIFIED="1481599492544" TEXT="Locking klären">
|
<node CREATED="1481599421021" ID="ID_461768132" MODIFIED="1481686898425" TEXT="Locking klären">
|
||||||
<icon BUILTIN="pencil"/>
|
|
||||||
<node CREATED="1481684383530" ID="ID_236117" MODIFIED="1481684451657" TEXT="zwei unabhängige Locks">
|
<node CREATED="1481684383530" ID="ID_236117" MODIFIED="1481684451657" TEXT="zwei unabhängige Locks">
|
||||||
<icon BUILTIN="yes"/>
|
<icon BUILTIN="yes"/>
|
||||||
<node CREATED="1481684391921" ID="ID_138369898" MODIFIED="1481684442846" TEXT="Front-End">
|
<node CREATED="1481684391921" ID="ID_138369898" MODIFIED="1481684442846" TEXT="Front-End">
|
||||||
|
|
@ -257,13 +256,56 @@
|
||||||
<icon BUILTIN="messagebox_warning"/>
|
<icon BUILTIN="messagebox_warning"/>
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
<node CREATED="1481599430804" ID="ID_1105415989" MODIFIED="1481599438887" TEXT="Forwarding-Operationen implementieren"/>
|
<node CREATED="1481599430804" ID="ID_1105415989" MODIFIED="1481599438887" TEXT="Forwarding-Operationen implementieren">
|
||||||
<node CREATED="1481599594399" ID="ID_1017459823" MODIFIED="1481599602601" TEXT="entscheiden, wer die Session öffnet">
|
<node CREATED="1481686902156" ID="ID_1526215617" MODIFIED="1481686910633" TEXT="aktivieren /deaktivieren">
|
||||||
|
<icon BUILTIN="button_ok"/>
|
||||||
|
</node>
|
||||||
|
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1481686911938" ID="ID_17287395" MODIFIED="1481686919619" TEXT="stoppen">
|
||||||
|
<icon BUILTIN="flag-yellow"/>
|
||||||
|
</node>
|
||||||
|
</node>
|
||||||
|
<node CREATED="1481599594399" ID="ID_1017459823" MODIFIED="1481687087609" TEXT="entscheiden, wer die Session öffnet">
|
||||||
|
<icon BUILTIN="button_ok"/>
|
||||||
|
<node CREATED="1481686982097" ID="ID_1925999031" MODIFIED="1481687002238" TEXT="passiert on demand">
|
||||||
|
<richcontent TYPE="NOTE"><html>
|
||||||
|
<head>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
...wenn jemand zugreift
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
</richcontent>
|
||||||
|
</node>
|
||||||
<node CREATED="1481599603757" ID="ID_812618450" MODIFIED="1481599612320" TEXT="Operation auf dem SessionManager"/>
|
<node CREATED="1481599603757" ID="ID_812618450" MODIFIED="1481599612320" TEXT="Operation auf dem SessionManager"/>
|
||||||
<node CREATED="1481599612812" ID="ID_1970476027" MODIFIED="1481599618598" TEXT="der ist Singleton"/>
|
<node CREATED="1481599612812" ID="ID_1970476027" MODIFIED="1481599618598" TEXT="der ist Singleton"/>
|
||||||
<node CREATED="1481599626194" ID="ID_1815350592" MODIFIED="1481599638105" TEXT="wenn Session öffnet, wird der Dispatcher aktiviert">
|
<node CREATED="1481599626194" ID="ID_1815350592" MODIFIED="1481599638105" TEXT="wenn Session öffnet, wird der Dispatcher aktiviert">
|
||||||
<icon BUILTIN="idea"/>
|
<icon BUILTIN="idea"/>
|
||||||
</node>
|
</node>
|
||||||
|
<node CREATED="1481687005813" ID="ID_1108477992" MODIFIED="1481687081246" TEXT="Entscheidung: Sesion-lifecycle und Dispatcher sind unabhängig">
|
||||||
|
<richcontent TYPE="NOTE"><html>
|
||||||
|
<head>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
grundlegende Design-Enscheidung
|
||||||
|
</p>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
wir haben Komponenten mit Dependency-Injection
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
da beide Komponenten nur nach ihren eigenen Hinsichten funktionieren,<br />wird das System insgesamt einfacher
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
</richcontent>
|
||||||
|
<icon BUILTIN="yes"/>
|
||||||
|
</node>
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1481510231986" ID="ID_45803267" MODIFIED="1481510243425" TEXT="TODO: dort SessionCommandService instantiieren">
|
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1481510231986" ID="ID_45803267" MODIFIED="1481510243425" TEXT="TODO: dort SessionCommandService instantiieren">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue