From 37900e22a8095bac480985a25bae11c6664e137f Mon Sep 17 00:00:00 2001 From: James Turner Date: Thu, 24 Jan 2013 09:27:09 +0100 Subject: [PATCH] Wrap dialog and joystick stat-cache in a transaction. Should improve startup times when the cache is rebuilt. --- src/GUI/new_gui.cxx | 3 ++- src/Input/FGDeviceConfigurationMap.cxx | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/GUI/new_gui.cxx b/src/GUI/new_gui.cxx index 2202ab97d..4975b193f 100644 --- a/src/GUI/new_gui.cxx +++ b/src/GUI/new_gui.cxx @@ -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 diff --git a/src/Input/FGDeviceConfigurationMap.cxx b/src/Input/FGDeviceConfigurationMap.cxx index 1da399fb5..73e9afd05 100644 --- a/src/Input/FGDeviceConfigurationMap.cxx +++ b/src/Input/FGDeviceConfigurationMap.cxx @@ -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()) { -- 2.39.5