comparison 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
comparison
equal deleted inserted replaced
547:806e3c72b5df 548:1469caaa8e67
161 }; 161 };
162 162
163 typedef std::vector<CacheBlock *> CacheVector; 163 typedef std::vector<CacheBlock *> CacheVector;
164 CacheVector m_caches; 164 CacheVector m_caches;
165 QReadWriteLock m_cacheVectorLock; // locks cache lookup, not use 165 QReadWriteLock m_cacheVectorLock; // locks cache lookup, not use
166 QMutex m_cacheCreationMutex; // solely to serialise makeCache() calls
166 167
167 FFTCacheReader *getCacheReader(size_t x, size_t &col) { 168 FFTCacheReader *getCacheReader(size_t x, size_t &col) {
168 Profiler profiler("FFTDataServer::getCacheReader"); 169 Profiler profiler("FFTDataServer::getCacheReader");
169 col = x & m_cacheWidthMask; 170 col = x & m_cacheWidthMask;
170 int c = x >> m_cacheWidthPower; 171 int c = x >> m_cacheWidthPower;
215 return getCacheWriter(x, col); 216 return getCacheWriter(x, col);
216 } 217 }
217 218
218 bool haveCache(size_t x) { 219 bool haveCache(size_t x) {
219 int c = x >> m_cacheWidthPower; 220 int c = x >> m_cacheWidthPower;
220 return (m_caches[c] != 0); 221 return (m_caches.at(c) != 0);
221 } 222 }
222 223
223 bool makeCache(int c); 224 bool makeCache(int c);
224 bool makeCacheReader(int c); 225 bool makeCacheReader(int c);
225 226