define session subsystem lifefycle (#318)

...by forwarding over the static interface to the ProcDispatcher
This commit is contained in:
Fischlurch 2016-12-13 02:44:37 +01:00
parent 014a828c63
commit 08e426047b
3 changed files with 20 additions and 14 deletions

View file

@ -93,7 +93,7 @@ namespace gui {
bool
shouldStart (lumiera::Option& opts) override
{
if (opts.isHeadless() || 0 < opts.getPort())
if (opts.isHeadless() or 0 < opts.getPort())
{
INFO (guifacade, "*not* starting the GUI...");
return false;

View file

@ -89,7 +89,9 @@ namespace lumiera {
/** query application option state to determine
* if this subsystem should be activated. */
* if this subsystem should be activated.
* @note even if not started explicitly, it could still
* be started as prerequisite of another one */
virtual bool shouldStart (lumiera::Option&) =0;

View file

@ -23,16 +23,23 @@
#include "proc/facade.hpp"
#include "lib/depend.hpp"
//#include "lib/sync.hpp"
#include "proc/control/proc-dispatcher.hpp"
#include "proc/play/output-director.hpp"
#include <string>
//#include <memory>
namespace proc {
using std::string;
using std::unique_ptr;
using lumiera::Subsys;
using lumiera::Option;
using lib::Sync;
// using lib::RecursiveLock_NoWait;
using proc::control::ProcDispatcher;
class BuilderSubsysDescriptor
@ -71,38 +78,35 @@ namespace proc {
class SessionSubsysDescriptor
class SessionSubsystem
: public Subsys
{
operator string () const { return "Session"; }
/** @remarks there is no need explicitly to start the session core,
* since it will usually be pulled up as prerequisite */
bool
shouldStart (Option&) override
{
TODO ("determine, if an existing Session should be loaded");
return false;
}
bool
start (Option&, Subsys::SigTerm termination) override
start (Option&, Subsys::SigTerm termNotification) override
{
UNIMPLEMENTED ("load an existing session as denoted by the options and register shutdown hook");
return false;
//////////////////////////////////////////////////////////TICKET #318 : start Thread and instantiate SessionCommandService
return ProcDispatcher::instance().start (termNotification);
}
void
triggerShutdown () noexcept override
{
UNIMPLEMENTED ("initiate closing this Session");
ProcDispatcher::instance().requestStop();
}
bool
checkRunningState () noexcept override
{
//Lock guard (*this);
TODO ("implement detecting running state");
return false;
return ProcDispatcher::instance().isRunning();
}
};
@ -153,7 +157,7 @@ namespace proc {
namespace {
lib::Depend<BuilderSubsysDescriptor> theBuilderDescriptor;
lib::Depend<SessionSubsysDescriptor> theSessionDescriptor;
lib::Depend<SessionSubsystem> theSessionSubsystemLifecycle;
lib::Depend<PlayOutSubsysDescriptor> thePlayOutDescriptor;
}
@ -172,7 +176,7 @@ namespace proc {
Subsys&
Facade::getSessionDescriptor()
{
return theSessionDescriptor();
return theSessionSubsystemLifecycle();
}