Re-organized the access of the mutex in Terrain to avoid deadlocks, and temporarily switched off the update of the neightbouring tile boundaries within the GeometryTechnique::generateGeometry method, again to avoid deadlocks.

This commit is contained in:
Robert Osfield 2010-06-16 12:46:16 +00:00
parent d3527f3830
commit 80389a4a13
2 changed files with 11 additions and 5 deletions

View File

@ -903,7 +903,7 @@ void GeometryTechnique::generateGeometry(BufferData& buffer, Locator* masterLoca
_neighbours.clear();
bool updateNeighboursImmediately = true;
bool updateNeighboursImmediately = false;
if (left_tile.valid()) addNeighbour(left_tile.get());
if (right_tile.valid()) addNeighbour(right_tile.get());

View File

@ -83,16 +83,22 @@ void Terrain::traverse(osg::NodeVisitor& nv)
// need to check if any TerrainTechniques need to have their update called on them.
osgUtil::UpdateVisitor* uv = dynamic_cast<osgUtil::UpdateVisitor*>(&nv);
if (uv)
{
typedef std::list< osg::ref_ptr<TerrainTile> > TerrainTileList;
TerrainTileList tiles;
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
for(TerrainTileSet::iterator itr = _updateTerrainTileSet.begin();
itr != _updateTerrainTileSet.end();
std::copy(_updateTerrainTileSet.begin(), _updateTerrainTileSet.end(), std::back_inserter(tiles));
_updateTerrainTileSet.clear();
}
for(TerrainTileList::iterator itr = tiles.begin();
itr != tiles.end();
++itr)
{
TerrainTile* tile = *itr;
tile->traverse(nv);
}
_updateTerrainTileSet.clear();
}
}