From 651541a899f8674e06501686de4fc4715ff0d044 Mon Sep 17 00:00:00 2001 From: Steve Bennetts Date: Sun, 15 Nov 2009 22:39:48 -0800 Subject: Fixed a deadlock causing textrue caching to stall. --- indra/newview/lltexturecache.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra') 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; -- cgit v1.2.3