diff transform/TransformFactory.cpp @ 477:e0784311a103

* Start thread to populate uninstalled transforms only on request (so runner doesn't have to have it)
author Chris Cannam
date Tue, 11 Nov 2008 09:41:45 +0000
parents a70dcfed59c1
children f933062a7f80
line wrap: on
line diff
--- a/transform/TransformFactory.cpp	Fri Nov 07 20:25:57 2008 +0000
+++ b/transform/TransformFactory.cpp	Tue Nov 11 09:41:45 2008 +0000
@@ -51,17 +51,27 @@
 
 TransformFactory::TransformFactory() :
     m_transformsPopulated(false),
-    m_uninstalledTransformsPopulated(false)
+    m_uninstalledTransformsPopulated(false),
+    m_thread(0)
 {
-    UninstalledTransformsPopulateThread *thread =
-        new UninstalledTransformsPopulateThread(this);
-    thread->start();
 }
 
 TransformFactory::~TransformFactory()
 {
 }
 
+void
+TransformFactory::startPopulationThread()
+{
+    MutexLocker locker(&m_uninstalledTransformsMutex,
+                       "TransformFactory::startPopulationThread");
+
+    if (m_thread) return;
+
+    m_thread = new UninstalledTransformsPopulateThread(this);
+    m_thread->start();
+}
+
 TransformList
 TransformFactory::getAllTransformDescriptions()
 {