more clean-up and comments

This commit is contained in:
Fischlurch 2016-12-22 19:35:42 +01:00
parent ad6a2ef090
commit 8bbc0fb97f
5 changed files with 45 additions and 28 deletions

View file

@ -218,6 +218,7 @@ namespace backend {
static void
syncPoint ()
{
////////////////////////////////////////////////////////TICKET #1054 : consider to call safeguard here, to ensure this is called from within the thread
lumiera_thread_sync ();
}
};

View file

@ -23,10 +23,26 @@
/** @file proc-dispatcher.cpp
** Implementation details of running commands and the builder.
** The ProcDispatcher is at the heart of the session subsystem and implements
** a (single) session thread to perform commands and trigger builder runs.
** New commands can be enqueued with a dedicated CommandQueue, while the details
** of operation control logic are encapsulated in a [logic component](\ref Looper).
** The ProcDispatcher is at the heart of the session subsystem and implements a
** (single) session thread to perform commands and trigger builder runs. New commands
** can be enqueued with a dedicated CommandQueue, while the details of operation control
** logic are encapsulated in a [logic component](\ref Looper).
**
** # Operational Semantics
** We need to distinguish between the ProcDispatcher itself, which is a static (singleton) service,
** and the »Session Subsystem« plus the _Session proper._ The subsystem has an application-global lifecycle,
** while the Session itself is a data structure and can be closed, opened or re-loaded. There is a singular
** transactional access point to the Session datastructure, which can be switched to new session contents.
** But external manipulation of the session contents is performed by commands, which are _dispatched_ --
** to manage this process is the concern of the »Session Subsystem«.
**
** Closing a session blocks further command processing, while the lifecycle of the _Session Subsystem_ is
** actually linked to _running the \ref DispatcherLoop_ -- implementation logic defined in this translation
** unit here. This loop implementation is performed in a dedicated thread, _the Session Loop Thread._ And
** this also entails opening the public SessionCommandService interface.
**
** ## Loop operation control
**
**
** @todo as of 12/2016, implementation has been drafted and is very much WIP
** @todo //////////////////////////////////////////////////////TODO ensure really every state change triggers a wakeup!!!!!!!
@ -66,8 +82,8 @@ namespace control {
, public Sync<RecursiveLock_Waitable>
{
bool canDispatch_{false};
bool blocked_ {false};
/** manage the primary public Session interface */
unique_ptr<SessionCommandService> commandService_;
CommandQueue queue_;
@ -78,7 +94,7 @@ namespace control {
DispatcherLoop (Subsys::SigTerm notification)
: ThreadJoinable("Lumiera Session"
, bind (&DispatcherLoop::runSessionThread, this, notification))
, commandService_(new SessionCommandService(*this))
, commandService_{new SessionCommandService(*this)}
, queue_()
, looper_([&]() -> bool
{
@ -93,7 +109,7 @@ namespace control {
{
try {
Lock sync(this);
commandService_.reset(); // redundant call, ensure the session interface is reliably closed
commandService_.reset(); // redundant call, to ensure session interface is closed reliably
this->join(); // block until the loop thread terminates and is reaped
INFO (session, "Proc-Dispatcher stopped.");
}

View file

@ -35,22 +35,18 @@
#ifndef PROC_CONTROL_PROC_DISPATCHER_H
#define PROC_CONTROL_PROC_DISPATCHER_H
//#include "lib/symbol.hpp"
#include "common/subsys.hpp"
#include "lib/depend.hpp"
#include "lib/sync.hpp"
#include <memory>
//#include <functional>
namespace proc {
namespace control {
// using lib::Symbol;
using std::unique_ptr;
// using std::bind;
using lumiera::Subsys;
@ -79,14 +75,9 @@ namespace control {
void awaitDeactivation();
void clear();
/* == diagnostics == */
// size_t size() const ;
bool empty() const ;
};
////////////////TODO currently just fleshing out the API....

View file

@ -140,6 +140,7 @@ namespace session {
void
getSessionReady() override
{
/////////////////////////////////////////////TODO anything to do here?
INFO (session, "Session ready for use.");
}

View file

@ -11016,7 +11016,7 @@
</node>
</node>
<node CREATED="1481778538165" HGAP="37" ID="ID_522398894" MODIFIED="1481778549049" TEXT="ProcDispatcher" VSHIFT="12">
<node CREATED="1481826274018" HGAP="18" ID="ID_1916296972" MODIFIED="1481917919910" TEXT="Requirements" VSHIFT="-7">
<node CREATED="1481826274018" HGAP="18" ID="ID_1916296972" MODIFIED="1482430840977" TEXT="Requirements" VSHIFT="-7">
<icon BUILTIN="button_ok"/>
<node CREATED="1481826329819" ID="ID_1238318698" MODIFIED="1481826431105" TEXT="enqueue commands concurrently">
<node CREATED="1481827297122" ID="ID_860095678" MODIFIED="1481827311268" TEXT="FIFO for regular commands"/>
@ -11042,7 +11042,7 @@
<node CREATED="1481827652539" ID="ID_313823253" MODIFIED="1481827657846" TEXT="supersede"/>
</node>
</node>
<node CREATED="1481917572639" HGAP="74" ID="ID_190109346" MODIFIED="1481917906139" TEXT="operational" VSHIFT="-27">
<node CREATED="1481917572639" HGAP="74" ID="ID_190109346" MODIFIED="1482430844888" TEXT="operational" VSHIFT="-27">
<icon BUILTIN="pencil"/>
<node CREATED="1481917612602" ID="ID_567971228" MODIFIED="1481917622388" TEXT="Loop l&#xe4;uft stets, aber blockt ggfs"/>
<node CREATED="1481917641910" ID="ID_1157396234" MODIFIED="1481917663639" TEXT="anf&#xe4;nglich idle --&gt; schlafen"/>
@ -11188,7 +11188,14 @@
</node>
</node>
</node>
<node CREATED="1481778549940" HGAP="35" ID="ID_676848252" MODIFIED="1481828600299" TEXT="DispatcherLoop">
<node CREATED="1481828583551" HGAP="148" ID="ID_436508747" MODIFIED="1482430869706" TEXT="Aufbau" VSHIFT="-35">
<icon BUILTIN="button_ok"/>
<node CREATED="1481828611347" ID="ID_160907866" MODIFIED="1481828614071" TEXT="Front-End"/>
<node CREATED="1481828614827" ID="ID_1752707995" MODIFIED="1481828622958" TEXT="DispatcherLoop PImpl"/>
<node CREATED="1481828624042" ID="ID_1970372601" MODIFIED="1481828635748" TEXT="Looper f&#xfc;r Schleifen-Logik"/>
<node CREATED="1481828639584" ID="ID_1344182776" MODIFIED="1481828648402" TEXT="CommandQueue"/>
</node>
<node CREATED="1481778549940" HGAP="35" ID="ID_676848252" MODIFIED="1482430860737" TEXT="DispatcherLoop">
<icon BUILTIN="pencil"/>
<node CREATED="1481778741546" ID="ID_684867533" MODIFIED="1481778755694" TEXT="&#xf6;ffnet Session-Interface">
<icon BUILTIN="button_ok"/>
@ -11287,7 +11294,7 @@
</node>
</node>
</node>
<node COLOR="#338800" CREATED="1481778708207" HGAP="48" ID="ID_1311208726" MODIFIED="1482375858816" TEXT="Builder-Steuerung" VSHIFT="-5">
<node COLOR="#338800" CREATED="1481778708207" FOLDED="true" HGAP="48" ID="ID_1311208726" MODIFIED="1482430859075" TEXT="Builder-Steuerung" VSHIFT="-5">
<linktarget COLOR="#5242a4" DESTINATION="ID_1311208726" ENDARROW="Default" ENDINCLINATION="2;-45;" ID="Arrow_ID_313252247" SOURCE="ID_209292609" STARTARROW="None" STARTINCLINATION="-186;-13;"/>
<icon BUILTIN="button_ok"/>
<node CREATED="1481828478741" ID="ID_1706868067" MODIFIED="1481828497838" TEXT="Hysterese"/>
@ -11321,7 +11328,7 @@
<node CREATED="1482365133332" ID="ID_99275973" MODIFIED="1482365147008" TEXT="moderne / zeitgem&#xe4;&#xdf;e Implementierung">
<icon BUILTIN="help"/>
</node>
<node CREATED="1482365613228" ID="ID_1195899391" MODIFIED="1482365638775">
<node CREATED="1482365613228" FOLDED="true" ID="ID_1195899391" MODIFIED="1482430741670">
<richcontent TYPE="NODE"><html>
<head>
@ -11333,6 +11340,13 @@
</body>
</html>
</richcontent>
<icon BUILTIN="button_ok"/>
<node CREATED="1482430715396" ID="ID_1005651794" MODIFIED="1482430722896" TEXT="nicht besonders sch&#xf6;n">
<icon BUILTIN="smily_bad"/>
</node>
<node CREATED="1482430724019" ID="ID_880234680" MODIFIED="1482430733678" TEXT="sollte mit std::chrono integrieren">
<icon BUILTIN="idea"/>
</node>
</node>
</node>
<node CREATED="1482202066204" HGAP="23" ID="ID_41541843" MODIFIED="1482202078184" TEXT="L&#xf6;sungnsansatz" VSHIFT="16">
@ -11400,12 +11414,6 @@
</node>
</node>
</node>
<node CREATED="1481828583551" ID="ID_436508747" MODIFIED="1481828608672" TEXT="Aufbau">
<node CREATED="1481828611347" ID="ID_160907866" MODIFIED="1481828614071" TEXT="Front-End"/>
<node CREATED="1481828614827" ID="ID_1752707995" MODIFIED="1481828622958" TEXT="DispatcherLoop PImpl"/>
<node CREATED="1481828624042" ID="ID_1970372601" MODIFIED="1481828635748" TEXT="Looper f&#xfc;r Schleifen-Logik"/>
<node CREATED="1481828639584" ID="ID_1344182776" MODIFIED="1481828648402" TEXT="CommandQueue"/>
</node>
</node>
</node>
<node CREATED="1448314932726" ID="ID_669869188" MODIFIED="1448314941137" POSITION="right" TEXT="Render"/>