remove crazy locking until I have a better idea

This commit is contained in:
Patrick von Reth 2014-02-19 11:17:57 +01:00
parent e26cbde75a
commit 56b1a0a3ae
2 changed files with 3 additions and 19 deletions

View File

@ -104,23 +104,8 @@ const QList<SnorePlugin::PluginTypes> &PluginContainer::types()
return t;
}
void PluginContainer::updatePluginCache(bool force)
void PluginContainer::updatePluginCache()
{
QSystemSemaphore sema("cache_update", 1, QSystemSemaphore::Open);
if(sema.acquire())
{
cache().sync();
if(!force && cache().value("version").toString() == Version::revision())
{
sema.release();
return;
}
}
else
{
qFatal("Failed to lock cache");
}
snoreDebug( SNORE_DEBUG ) << "Updating plugin cache";
foreach(PluginContaienrHash list, s_pluginCache)
{
@ -174,7 +159,6 @@ void PluginContainer::updatePluginCache(bool force)
}
cache().endArray();
cache().sync();
sema.release();
}
void PluginContainer::loadPluginCache()
@ -194,7 +178,7 @@ void PluginContainer::loadPluginCache()
{
snoreDebug( SNORE_WARNING ) << "Cache Corrupted" << fileName << cache().value("name").toString() << type;
cache().endArray();
updatePluginCache(true);
updatePluginCache();
return;
}
}

View File

@ -56,7 +56,7 @@ public:
private:
static QHash<SnorePlugin::PluginTypes, PluginContaienrHash > s_pluginCache;
void static updatePluginCache(bool force = false);
void static updatePluginCache();
void static loadPluginCache();
static const QDir &pluginDir();
static inline const QString pluginExtention()