Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
output-director.cpp
Go to the documentation of this file.
1/*
2 OutputDirector - handling all the real external output connections
3
4 Copyright (C)
5 2011, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12* *****************************************************************/
13
14
23#include "lib/thread.hpp"
24
26
27
28namespace steam {
29namespace play {
30
31
32
33 namespace { // hidden local details of the service implementation....
34
35 } // (End) hidden service impl details
36
37
38
41
42
50 : player_{PlayServiceHandle::NOT_YET_STARTED}
51 , shutdown_initiated_{false}
52 { }
53
55
56
57
62 bool
64 {
65 Lock sync{this};
66 REQUIRE (not shutdown_initiated_);
67
69 return this->isOperational();
70 }
71
72
74 bool
76 {
77 return bool(player_);
78 }
79
80
81
90 void
91 OutputDirector::triggerDisconnect (SigTerm completedSignal) noexcept
92 {
93 if (not shutdown_initiated_)
94 {
95 shutdown_initiated_ = true;
96 launchDetached ("Output shutdown supervisor"
97 ,[=,this]{
98 bringDown (completedSignal);
99 });
100 }
101 }
102
103
113 void
115 {
116 Lock sync{this};
117 string problemLog;
118 if (not isOperational())
119 {
120 WARN (play, "Attempt to OutputDirector::bringDown() -- "
121 "which it is not in running state. Invocation ignored. "
122 "This indicates an error in Lifecycle logic.");
123 return;
124 }
125 try
126 {
127 TODO ("actually bring down the output generation");
129
130 completedSignal(0);
131 }
132
133 catch (lumiera::Error& problem)
134 {
135 problemLog = problem.what();
136 lumiera_error(); // reset error state
137 completedSignal (&problemLog);
138 }
139 catch (...)
140 {
141 problemLog = "Unknown error while disconnecting output. "
142 "Lumiera error flag is = "+string(lumiera_error());
143 completedSignal (&problemLog);
144 }
145 }
146
147}} // namespace steam::play
Configuration handle to expose a service implementation through the Depend<SRV> front-end.
IMP & createInstance(ARGS &&...ctorArgs)
Access point to singletons and other kinds of dependencies designated by type.
Definition depend.hpp:281
scoped guard to control the actual locking.
Definition sync.hpp:228
Interface and Base definition for all Lumiera Exceptions.
Definition error.hpp:65
virtual CStr what() const noexcept override
std::exception interface : yield a diagnostic message
lumiera::Subsys::SigTerm SigTerm
bool connectUp()
connect and bring up the external input/output connections, handlers and interface services and the r...
OutputDirector()
bring up the framework for handling input/output connections.
void bringDown(SigTerm completedSignal)
void triggerDisconnect(SigTerm) noexcept
initiate shutdown of all ongoing render/playback processes and closing of all external input/output i...
static lib::Depend< OutputDirector > instance
storage for the single application wide OutputDirector instance
lumiera_err lumiera_error(void)
Get and clear current error state.
void launchDetached(ThreadHookable::Launch &&launchBuilder)
Launch an autonomous self-managing thread (and forget about it).
Definition thread.hpp:742
Steam-Layer implementation namespace root.
A global service to coordinate and handle all external output activities.
A global service to handle all external output connections.
Primary service of the Player subsystem: Starting and controlling render/playback.
Convenience front-end to simplify and codify basic thread handling.