Fix re-entrance in Application shutdown(#954)
doh... this happens when you draft some quite intricate logic and then get sidelined with other tasks for several years. Mind me, I didn't even recall that I had treated this whole issue and created a clean-up thread. A full fledged implementation would have a real lifecycle and thus detect the re-entrance; but since none of the components to be managed by the OutputDirector is even remotely planned or even coded, the functions were just drafted as stubs. Which caused us happily to create yet another clean-up thread whenever the subsystem-runner signalled "please shut down".
This commit is contained in:
parent
4ef4f2bdc5
commit
964a372d67
2 changed files with 10 additions and 3 deletions
|
|
@ -60,19 +60,19 @@ namespace play {
|
|||
/** connect and bring up the external input/output connections,
|
||||
* handlers and interface services and the render/playback service.
|
||||
* @return true if the output subsystem can be considered operational
|
||||
*
|
||||
* @todo WIP-WIP-WIP 6/2011
|
||||
*/
|
||||
bool
|
||||
OutputDirector::connectUp()
|
||||
{
|
||||
Lock sync(this);
|
||||
REQUIRE (!shutdown_initiated_);
|
||||
|
||||
player_.reset (new PlayService);
|
||||
return this->isOperational();
|
||||
}
|
||||
|
||||
|
||||
/** @todo WIP-WIP-WIP 6/2011 */
|
||||
bool
|
||||
OutputDirector::isOperational() const
|
||||
{
|
||||
|
|
@ -92,7 +92,11 @@ namespace play {
|
|||
void
|
||||
OutputDirector::triggerDisconnect (SigTerm completedSignal) throw()
|
||||
{
|
||||
Thread ("Output shutdown supervisor", bind (&OutputDirector::bringDown, this, completedSignal));
|
||||
if (!shutdown_initiated_)
|
||||
{
|
||||
shutdown_initiated_ = true;
|
||||
Thread ("Output shutdown supervisor", bind (&OutputDirector::bringDown, this, completedSignal));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,9 @@ namespace play {
|
|||
typedef lumiera::Subsys::SigTerm SigTerm;
|
||||
|
||||
scoped_ptr<PlayService> player_;
|
||||
///////TODO more components and connections to manage here...
|
||||
|
||||
bool shutdown_initiated_ = false; /////TODO probably need a way more elaborate lifecylce management
|
||||
|
||||
public:
|
||||
static lib::Depend<OutputDirector> instance;
|
||||
|
|
|
|||
Loading…
Reference in a new issue