Fixes for benign threading memory contentions.

This commit is contained in:
Robert Osfield 2010-12-08 09:52:58 +00:00
parent b2cf978ae3
commit 1b42084217

View File

@ -778,19 +778,6 @@ void DatabasePager::DatabaseThread::run()
{
OSG_INFO<<_name<<": DatabasePager::DatabaseThread::run"<<std::endl;
#if 1
// need to set the texture object manager to be able to reuse textures
osg::Texture::setMinimumNumberOfTextureObjectsToRetainInCache(100);
// need to set the display list manager to be able to reuse display lists
osg::Drawable::setMinimumNumberOfDisplayListsToRetainInCache(100);
#else
// need to set the texture object manager to be able to reuse textures
osg::Texture::setMinimumNumberOfTextureObjectsToRetainInCache(0);
// need to set the display list manager to be able to reuse display lists
osg::Drawable::setMinimumNumberOfDisplayListsToRetainInCache(0);
#endif
bool firstTime = true;
@ -827,19 +814,23 @@ void DatabasePager::DatabaseThread::run()
OSG_INFO<<_name<<": _pager->size()= "<<read_queue->size()<<" to delete = "<<read_queue->_childrenToDeleteList.size()<<std::endl;
//
// delete any children if required.
//
if (_pager->_deleteRemovedSubgraphsInDatabaseThread && !(read_queue->_childrenToDeleteList.empty()))
if (_pager->_deleteRemovedSubgraphsInDatabaseThread/* && !(read_queue->_childrenToDeleteList.empty())*/)
{
ObjectList deleteList;
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(read_queue->_childrenToDeleteListMutex);
if (!read_queue->_childrenToDeleteList.empty())
{
deleteList.swap(read_queue->_childrenToDeleteList);
read_queue->updateBlock();
}
}
}
//
// load any subgraphs that are required.
@ -1296,6 +1287,20 @@ DatabasePager::DatabasePager(const DatabasePager& rhs)
_activePagedLODList = rhs._activePagedLODList->clone();
_inactivePagedLODList = rhs._inactivePagedLODList->clone();
#if 1
// need to set the texture object manager to be able to reuse textures
osg::Texture::setMinimumNumberOfTextureObjectsToRetainInCache(100);
// need to set the display list manager to be able to reuse display lists
osg::Drawable::setMinimumNumberOfDisplayListsToRetainInCache(100);
#else
// need to set the texture object manager to be able to reuse textures
osg::Texture::setMinimumNumberOfTextureObjectsToRetainInCache(0);
// need to set the display list manager to be able to reuse display lists
osg::Drawable::setMinimumNumberOfDisplayListsToRetainInCache(0);
#endif
// initialize the stats variables
resetStats();
}