changeset 482:f54381e01141

* Fix a deadlock * Make debug output more suited to datastore rdf implementation
author Chris Cannam
date Fri, 14 Nov 2008 12:29:48 +0000
parents a82645e788fc
children b13213785a6f
files rdf/PluginRDFIndexer.cpp transform/TransformFactory.cpp
diffstat 2 files changed, 24 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/rdf/PluginRDFIndexer.cpp	Fri Nov 14 10:10:05 2008 +0000
+++ b/rdf/PluginRDFIndexer.cpp	Fri Nov 14 12:29:48 2008 +0000
@@ -342,17 +342,14 @@
         QString identifier = (*i)["plugin_id"].value;
 
         if (identifier == "") {
-            cerr << "PluginRDFIndexer::indexURL: NOTE: Document at <"
-                 << urlString.toStdString()
-                 << "> fails to define any vamp:identifier for plugin <"
+            cerr << "PluginRDFIndexer::indexURL: NOTE: No vamp:identifier for plugin <"
                  << pluginUri.toStdString() << ">"
                  << endl;
             continue;
         }
         if (soUri == "") {
-            cerr << "PluginRDFIndexer::indexURL: NOTE: Document at <"
-                 << urlString.toStdString() << "> does not associate plugin <"
-                 << pluginUri.toStdString() << "> with any implementation library"
+            cerr << "PluginRDFIndexer::indexURL: NOTE: No implementation library for plugin <"
+                 << pluginUri.toStdString() << ">"
                  << endl;
             continue;
         }
@@ -373,8 +370,7 @@
             SimpleSPARQLQuery::singleResultQuery(localString, sonameQuery, "library_id");
         QString soname = sonameValue.value;
         if (soname == "") {
-            cerr << "PluginRDFIndexer::indexURL: NOTE: Document at <"
-                 << urlString.toStdString() << "> omits identifier for library <"
+            cerr << "PluginRDFIndexer::indexURL: NOTE: No identifier for library <"
                  << soUri.toStdString() << ">"
                  << endl;
             continue;
@@ -393,12 +389,23 @@
         foundSomething = true;
 
         if (m_idToDescriptionMap.find(pluginId) != m_idToDescriptionMap.end()) {
+/*!!!
+
+  This can happen quite legitimately when using an RDF datastore rather
+  than querying individual files, as of course the datastore contains
+  all plugin data found so far, and each time a file is added to it,
+  subsequent queries will return all older plugins as well.
+
+  It would be more efficient to add everything at once and then do all
+  queries, of course.
+
             cerr << "PluginRDFIndexer::indexURL: NOTE: Plugin id \""
                  << pluginId.toStdString() << "\", described in document at <"
                  << urlString.toStdString()
                  << ">, has already been described in document <"
                  << m_idToDescriptionMap[pluginId].toStdString()
                  << ">: ignoring this new description" << endl;
+*/
             continue;
         }
 
--- a/transform/TransformFactory.cpp	Fri Nov 14 10:10:05 2008 +0000
+++ b/transform/TransformFactory.cpp	Fri Nov 14 12:29:48 2008 +0000
@@ -63,12 +63,16 @@
 void
 TransformFactory::startPopulationThread()
 {
-    MutexLocker locker(&m_uninstalledTransformsMutex,
-                       "TransformFactory::startPopulationThread");
+    m_uninstalledTransformsMutex.lock();
 
-    if (m_thread) return;
+    if (m_thread) {
+        m_uninstalledTransformsMutex.unlock();
+        return;
+    }
+    m_thread = new UninstalledTransformsPopulateThread(this);
 
-    m_thread = new UninstalledTransformsPopulateThread(this);
+    m_uninstalledTransformsMutex.unlock();
+
     m_thread->start();
 }
 
@@ -173,11 +177,11 @@
     }
 
     if (m_uninstalledTransforms.find(id) != m_uninstalledTransforms.end()) {
+        m_uninstalledTransformsMutex.unlock();
         return TransformNotInstalled;
     }
 
     m_uninstalledTransformsMutex.unlock();
-
     return TransformUnknown;
 }