diff data/fft/FFTDataServer.h @ 548:1469caaa8e67

* Finer locking in fft caches; fix displayed bin ranges in spectrogram
author Chris Cannam
date Thu, 05 Feb 2009 12:05:28 +0000
parents 806e3c72b5df
children 388afa99d537
line wrap: on
line diff
--- a/data/fft/FFTDataServer.h	Wed Feb 04 20:39:11 2009 +0000
+++ b/data/fft/FFTDataServer.h	Thu Feb 05 12:05:28 2009 +0000
@@ -163,6 +163,7 @@
     typedef std::vector<CacheBlock *> CacheVector;
     CacheVector m_caches;
     QReadWriteLock m_cacheVectorLock; // locks cache lookup, not use
+    QMutex m_cacheCreationMutex; // solely to serialise makeCache() calls
 
     FFTCacheReader *getCacheReader(size_t x, size_t &col) {
         Profiler profiler("FFTDataServer::getCacheReader");
@@ -217,7 +218,7 @@
 
     bool haveCache(size_t x) {
         int c = x >> m_cacheWidthPower;
-        return (m_caches[c] != 0);
+        return (m_caches.at(c) != 0);
     }
     
     bool makeCache(int c);