From Tim Moore, fix for race conditions in takeOrGenerate() methods

This commit is contained in:
Robert Osfield
2010-12-17 13:43:41 +00:00
parent d8e3225cd8
commit 362edaa1b9
2 changed files with 16 additions and 10 deletions

View File

@@ -514,14 +514,17 @@ Texture::TextureObject* Texture::TextureObjectSet::takeFromOrphans(Texture* text
Texture::TextureObject* Texture::TextureObjectSet::takeOrGenerate(Texture* texture)
{
// see if we can recyle TextureObject from the orphane list
if (!_pendingOrphanedTextureObjects.empty())
// see if we can recyle TextureObject from the orphan list
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
handlePendingOrphandedTextureObjects();
return takeFromOrphans(texture);
if (!_pendingOrphanedTextureObjects.empty())
{
handlePendingOrphandedTextureObjects();
return takeFromOrphans(texture);
}
}
else if (!_orphanedTextureObjects.empty())
if (!_orphanedTextureObjects.empty())
{
return takeFromOrphans(texture);
}