diff options
author | Steve Bennetts <steve@lindenlab.com> | 2009-11-15 22:39:48 -0800 |
---|---|---|
committer | Steve Bennetts <steve@lindenlab.com> | 2009-11-15 22:39:48 -0800 |
commit | 651541a899f8674e06501686de4fc4715ff0d044 (patch) | |
tree | b191284e0067e67a2c82ade4fb16f7f4424792c3 | |
parent | 1e1b8d036f3cbcb81768150c66d5e3052118ed4c (diff) |
Fixed a deadlock causing textrue caching to stall.
-rw-r--r-- | indra/newview/lltexturecache.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 4f199e9da4..c33c652935 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -1506,7 +1506,7 @@ S32 LLTextureCache::getHeaderCacheEntry(const LLUUID& id, S32& imagesize) // Writes imagesize to the header, updates timestamp S32 LLTextureCache::setHeaderCacheEntry(const LLUUID& id, S32 imagesize) { - LLMutexLock lock(&mHeaderMutex); + mHeaderMutex.lock(); llassert_always(imagesize >= 0); Entry entry; S32 idx = openAndReadEntry(id, entry, true); @@ -1514,11 +1514,15 @@ S32 LLTextureCache::setHeaderCacheEntry(const LLUUID& id, S32 imagesize) { entry.mImageSize = imagesize; writeEntryAndClose(idx, entry); + mHeaderMutex.unlock(); } else // retry { + mHeaderMutex.unlock(); readHeaderCache(); // We couldn't write an entry, so refresh the LRU + mHeaderMutex.lock(); llassert_always(!mLRU.empty() || mHeaderEntriesInfo.mEntries < sCacheMaxEntries); + mHeaderMutex.unlock(); idx = setHeaderCacheEntry(id, imagesize); // assert above ensures no inf. recursion } return idx; @@ -1644,7 +1648,7 @@ void LLTextureCache::addCompleted(Responder* responder, bool success) ////////////////////////////////////////////////////////////////////////////// // Called from MAIN thread (endWork()) -// Ensuere that mHeaderMutex is locked first! +// Ensure that mHeaderMutex is locked first! bool LLTextureCache::removeHeaderCacheEntry(const LLUUID& id) { Entry entry; |