diff data/fft/FFTMemoryCache.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 3cc4b7cd2aa5
children 59e7fe1b1003
line wrap: on
line diff
--- a/data/fft/FFTMemoryCache.h	Wed Feb 04 20:39:11 2009 +0000
+++ b/data/fft/FFTMemoryCache.h	Thu Feb 05 12:05:28 2009 +0000
@@ -22,7 +22,7 @@
 #include "base/ResizeableBitset.h"
 #include "base/Profiler.h"
 
-#include <QMutex>
+#include <QReadWriteLock>
 
 /**
  * In-memory FFT cache.  For this we want to cache magnitude with
@@ -120,9 +120,9 @@
     }
 
     bool haveSetColumnAt(size_t x) const {
-        m_colsetMutex.lock();
+        m_colsetLock.lockForRead();
         bool have = m_colset.get(x);
-        m_colsetMutex.unlock();
+        m_colsetLock.unlock();
         return have;
     }
 
@@ -149,7 +149,7 @@
     float *m_factor;
     FFTCache::StorageType m_storageType;
     ResizeableBitset m_colset;
-    mutable QMutex m_colsetMutex;
+    mutable QReadWriteLock m_colsetLock;
 
     void initialise();