Reset: Terrasync root can change, can be shutdown.

This commit is contained in:
James Turner
2013-10-06 19:08:33 +02:00
parent 6527c6357b
commit b7df9026c0
2 changed files with 18 additions and 4 deletions

View File

@@ -755,11 +755,10 @@ void SGTerraSync::SvnThread::writeCompletedTilesPersistentCache() const
///////////////////////////////////////////////////////////////////////////////
// SGTerraSync ////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
SGTerraSync::SGTerraSync(SGPropertyNode_ptr root) :
SGTerraSync::SGTerraSync() :
_svnThread(NULL),
last_lat(NOWHERE),
last_lon(NOWHERE),
_terraRoot(root->getNode("/sim/terrasync",true)),
_bound(false),
_inited(false)
{
@@ -772,11 +771,16 @@ SGTerraSync::SGTerraSync(SGPropertyNode_ptr root) :
SGTerraSync::~SGTerraSync()
{
_tiedProperties.Untie();
delete _svnThread;
_svnThread = NULL;
sglog().removeCallback(_log);
delete _log;
_tiedProperties.Untie();
}
void SGTerraSync::setRoot(SGPropertyNode_ptr root)
{
_terraRoot = root->getNode("/sim/terrasync",true);
}
void SGTerraSync::init()
@@ -786,11 +790,18 @@ void SGTerraSync::init()
}
_inited = true;
assert(_terraRoot);
_terraRoot->setBoolValue("built-in-svn-available",svn_built_in_available);
reinit();
}
void SGTerraSync::shutdown()
{
_svnThread->stop();
}
void SGTerraSync::reinit()
{
// do not reinit when enabled and we're already up and running

View File

@@ -40,10 +40,11 @@ class SGTerraSync : public SGSubsystem
{
public:
SGTerraSync(SGPropertyNode_ptr root);
SGTerraSync();
virtual ~SGTerraSync();
virtual void init();
virtual void shutdown();
virtual void reinit();
virtual void bind();
virtual void unbind();
@@ -59,6 +60,8 @@ public:
bool scheduleTile(const SGBucket& bucket);
void setRoot(SGPropertyNode_ptr root);
/// retrive the associated log object, for displaying log
/// output somewhere (a UI, presumably)
BufferedLogCallback* log() const