]> git.mxchange.org Git - flightgear.git/commitdiff
Wrap dialog and joystick stat-cache in a transaction.
authorJames Turner <zakalawe@mac.com>
Thu, 24 Jan 2013 08:27:09 +0000 (09:27 +0100)
committerJames Turner <zakalawe@mac.com>
Thu, 24 Jan 2013 08:27:09 +0000 (09:27 +0100)
Should improve startup times when the cache is rebuilt.

src/GUI/new_gui.cxx
src/Input/FGDeviceConfigurationMap.cxx

index 2202ab97d8733d31884d86aba198f4fa5b106335..4975b193fa40498e30ee2c59d4c7c6c14f90b218 100644 (file)
@@ -289,10 +289,11 @@ NewGUI::newDialog (SGPropertyNode* props)
 void
 NewGUI::readDir (const SGPath& path)
 {
+    flightgear::NavDataCache* cache = flightgear::NavDataCache::instance();
+    flightgear::NavDataCache::Transaction txn(cache);
     simgear::Dir dir(path);
     simgear::PathList xmls = dir.children(simgear::Dir::TYPE_FILE, ".xml");
     
-    flightgear::NavDataCache* cache = flightgear::NavDataCache::instance();
     BOOST_FOREACH(SGPath xmlPath, xmls) {
       if (!cache->isCachedFileModified(xmlPath)) {
         // cached, easy
index 1da399fb5ae5db9dfe38d68fc157cee009b3f69a..73e9afd0587c04852dfa4cef0805b1dc819c09e3 100644 (file)
@@ -99,10 +99,12 @@ void FGDeviceConfigurationMap::scan_dir(const SGPath & path)
   if (!path.exists())
     return;
   
+  flightgear::NavDataCache* cache = flightgear::NavDataCache::instance();
+  flightgear::NavDataCache::Transaction txn(cache);
+  
   simgear::Dir dir(path);
   simgear::PathList children = dir.children(simgear::Dir::TYPE_FILE | 
     simgear::Dir::TYPE_DIR | simgear::Dir::NO_DOT_OR_DOTDOT);
-  flightgear::NavDataCache* cache = flightgear::NavDataCache::instance();
   
   BOOST_FOREACH(SGPath path, children) {
     if (path.isDir()) {