pass compiler and starts OK without doing anything
This commit is contained in:
parent
75b97ff9dd
commit
41f9f54907
12 changed files with 65 additions and 30 deletions
|
|
@ -24,15 +24,18 @@
|
|||
#include "backend/enginefacade.hpp"
|
||||
#include "common/singleton.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace backend {
|
||||
|
||||
using std::string;
|
||||
using lumiera::Subsys;
|
||||
|
||||
class EngineSubsysDescriptor
|
||||
: public Subsys
|
||||
{
|
||||
operator string () { return "Engine"; }
|
||||
operator string () const { return "Engine"; }
|
||||
|
||||
bool
|
||||
shouldStart (lumiera::Option&)
|
||||
|
|
|
|||
|
|
@ -24,15 +24,17 @@
|
|||
#include "backend/netnodefacade.hpp"
|
||||
#include "common/singleton.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace backend {
|
||||
|
||||
|
||||
using std::string;
|
||||
using lumiera::Subsys;
|
||||
|
||||
class NetNodeSubsysDescriptor
|
||||
: public Subsys
|
||||
{
|
||||
operator string () { return "Renderfarm node"; }
|
||||
operator string () const { return "Renderfarm node"; }
|
||||
|
||||
bool
|
||||
shouldStart (lumiera::Option&)
|
||||
|
|
|
|||
|
|
@ -24,15 +24,18 @@
|
|||
#include "backend/scriptrunnerfacade.hpp"
|
||||
#include "common/singleton.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace backend {
|
||||
|
||||
|
||||
using std::string;
|
||||
using lumiera::Subsys;
|
||||
|
||||
class ScriptRunnerSubsysDescriptor
|
||||
: public Subsys
|
||||
{
|
||||
operator string () { return "Script runner"; }
|
||||
operator string () const { return "Script runner"; }
|
||||
|
||||
bool
|
||||
shouldStart (lumiera::Option&)
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <boost/function.hpp>
|
||||
#include <tr1/functional>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "common/util.hpp"
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
namespace lumiera {
|
||||
|
||||
using boost::noncopyable;
|
||||
using boost::function;
|
||||
using std::tr1::function;
|
||||
using util::contains;
|
||||
using std::string;
|
||||
|
||||
|
|
|
|||
|
|
@ -195,7 +195,11 @@ namespace lumiera {
|
|||
|
||||
try
|
||||
{
|
||||
if (subsystems_) subsystems_->shutdownAll();
|
||||
if (subsystems_)
|
||||
{
|
||||
subsystems_->triggerEmergency(true);
|
||||
subsystems_->shutdownAll();
|
||||
}
|
||||
return maybeWait ();
|
||||
}
|
||||
catch (...)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
|
||||
//TODO: Lumiera header includes//
|
||||
#include "lumiera/lumiera.h"
|
||||
#include "lumiera/config.h"
|
||||
|
||||
//TODO: internal/static forward declarations//
|
||||
|
|
|
|||
|
|
@ -24,15 +24,18 @@
|
|||
#include "gui/guifacade.hpp"
|
||||
#include "common/singleton.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace gui {
|
||||
|
||||
|
||||
using std::string;
|
||||
using lumiera::Subsys;
|
||||
|
||||
class GuiSubsysDescriptor
|
||||
: public Subsys
|
||||
{
|
||||
operator string () { return "Lumiera GTK GUI"; }
|
||||
operator string () const { return "Lumiera GTK GUI"; }
|
||||
|
||||
bool
|
||||
shouldStart (lumiera::Option&)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
|
||||
|
||||
#include "lumiera/lumiera.h"
|
||||
#include "lumiera/plugin.h"
|
||||
#include "lumiera/interfaceregistry.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ namespace lumiera {
|
|||
bool
|
||||
Subsys::isRunning()
|
||||
{
|
||||
UNIMPLEMENTED ("maintain isRunning flag in a threadsafe manner");
|
||||
return false;
|
||||
TODO ("maintain isRunning flag in a threadsafe manner");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
#include "lumiera/option.hpp"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/tr1/functional.hpp>
|
||||
#include <tr1/functional>
|
||||
//#include <boost/scoped_ptr.hpp>
|
||||
//#include <string>
|
||||
#include <vector>
|
||||
|
|
@ -78,7 +78,7 @@ namespace lumiera {
|
|||
virtual ~Subsys();
|
||||
|
||||
/** a human readable name */
|
||||
virtual operator string () =0;
|
||||
virtual operator string () const =0;
|
||||
|
||||
|
||||
/** define a dependency to another Subsys
|
||||
|
|
@ -112,6 +112,10 @@ namespace lumiera {
|
|||
* terminate at any point without further notice*/
|
||||
bool isRunning();
|
||||
|
||||
const std::vector<Subsys*>
|
||||
getPrerequisites () { return prereq_; }
|
||||
|
||||
|
||||
|
||||
private:
|
||||
std::vector<Subsys*> prereq_;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include "lumiera/subsys.hpp"
|
||||
#include "common/multithread.hpp"
|
||||
|
||||
#include <boost/tr1/functional.hpp>
|
||||
#include <tr1/functional>
|
||||
#include <vector>
|
||||
|
||||
|
||||
|
|
@ -37,6 +37,7 @@ namespace lumiera {
|
|||
|
||||
using std::tr1::bind;
|
||||
using std::tr1::function;
|
||||
using std::tr1::placeholders::_1;
|
||||
using std::vector;
|
||||
using util::cStr;
|
||||
using util::isnil;
|
||||
|
|
@ -44,6 +45,13 @@ namespace lumiera {
|
|||
using util::for_each;
|
||||
using util::removeall;
|
||||
|
||||
namespace {
|
||||
function<bool(Subsys*)>
|
||||
isRunning() {
|
||||
return bind (&Subsys::isRunning, _1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Implementation helper for managing execution of a collection of subsystems,
|
||||
|
|
@ -81,15 +89,18 @@ namespace lumiera {
|
|||
class SubsystemRunner
|
||||
{
|
||||
Option& opts_;
|
||||
volatile bool emergency_;
|
||||
vector<Subsys*> running_;
|
||||
|
||||
function<void(Subsys&)> start_,
|
||||
function<void(Subsys*)> start_,
|
||||
killIt_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
SubsystemRunner (Option& opts)
|
||||
: opts_(opts)
|
||||
, emergency_(false)
|
||||
, start_(bind (&SubsystemRunner::triggerStartup, this,_1))
|
||||
, killIt_(bind (&Subsys::triggerShutdown, _1))
|
||||
{ }
|
||||
|
|
@ -112,13 +123,16 @@ namespace lumiera {
|
|||
for_each (running_, killIt_);
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
wait ()
|
||||
{
|
||||
//Lock(*this).wait (&SubsystemRunner::allDead);
|
||||
return isEmergencyExit();
|
||||
}
|
||||
|
||||
bool isEmergencyExit () { return emergency_; }
|
||||
void triggerEmergency (bool cond) { emergency_ |= cond; }
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
|
@ -129,17 +143,17 @@ namespace lumiera {
|
|||
ASSERT (susy);
|
||||
INFO (operate, "Starting subsystem \"%s\"", cStr(*susy));
|
||||
|
||||
for_each (susy->prereq_, start_);
|
||||
bool started = susy.start (opts_, bind (&SubsystemRunner::sigTerm, this, susy, _1));
|
||||
for_each (susy->getPrerequisites(), start_);
|
||||
bool started = susy->start (opts_, bind (&SubsystemRunner::sigTerm, this, susy, _1));
|
||||
|
||||
if (started && !susy.isRunning())
|
||||
if (started && !susy->isRunning())
|
||||
{
|
||||
throw error::Logic("Subsystem "+susy+" failed to start");
|
||||
throw error::Logic("Subsystem "+string(*susy)+" failed to start");
|
||||
}
|
||||
if (!and_all (susy->prereq_, isRunning_))
|
||||
if (!and_all (susy->getPrerequisites(), isRunning() ))
|
||||
{
|
||||
susy->triggerShutdown();
|
||||
throw error::Logic("Unable to start all prerequisites of Subsystem "+susy);
|
||||
throw error::Logic("Unable to start all prerequisites of Subsystem "+string(*susy));
|
||||
} }
|
||||
|
||||
void
|
||||
|
|
@ -147,8 +161,9 @@ namespace lumiera {
|
|||
{
|
||||
ASSERT (susy);
|
||||
//Lock guard (*this);
|
||||
ERROR_IF (susy.isRunning(), lumiera, "Subsystem '%s' signals termination, "
|
||||
"without resetting running state", cStr(susy));
|
||||
triggerEmergency(problem);
|
||||
ERROR_IF (susy->isRunning(), lumiera, "Subsystem '%s' signals termination, "
|
||||
"without resetting running state", cStr(*susy));
|
||||
removeall (running_, susy);
|
||||
shutdownAll();
|
||||
//guard.notify();
|
||||
|
|
|
|||
|
|
@ -24,16 +24,19 @@
|
|||
#include "proc/facade.hpp"
|
||||
#include "common/singleton.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace proc {
|
||||
|
||||
|
||||
using std::string;
|
||||
using lumiera::Subsys;
|
||||
|
||||
|
||||
class BuilderSubsysDescriptor
|
||||
: public Subsys
|
||||
{
|
||||
operator string () { return "Builder"; }
|
||||
operator string () const { return "Builder"; }
|
||||
|
||||
bool
|
||||
shouldStart (lumiera::Option&)
|
||||
|
|
@ -62,7 +65,7 @@ namespace proc {
|
|||
class SessionSubsysDescriptor
|
||||
: public Subsys
|
||||
{
|
||||
operator string () { return "Session"; }
|
||||
operator string () const { return "Session"; }
|
||||
|
||||
bool
|
||||
shouldStart (lumiera::Option&)
|
||||
|
|
|
|||
Loading…
Reference in a new issue