* Added static mutex to terrain load-tile to prevent file IO locking issues.
parent
2048d611cf
commit
6804f9affb
OpenSim/Region/Terrain.BasicTerrain
|
@ -51,6 +51,8 @@ namespace OpenSim.Region.Terrain
|
|||
|
||||
public class TerrainEngine
|
||||
{
|
||||
public static System.Threading.Mutex fileIOLock = new System.Threading.Mutex();
|
||||
|
||||
/// <summary>
|
||||
/// Plugin library for scripts
|
||||
/// </summary>
|
||||
|
@ -731,6 +733,10 @@ namespace OpenSim.Region.Terrain
|
|||
/// <param name="lowerboundY">Where do the region coords start for this terrain?</param>
|
||||
public void LoadFromFileF32(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY)
|
||||
{
|
||||
fileIOLock.WaitOne();
|
||||
try
|
||||
{
|
||||
|
||||
int sectionToLoadX = ((this.offsetX - lowerboundX) * this.w);
|
||||
int sectionToLoadY = ((this.offsetY - lowerboundY) * this.h);
|
||||
|
||||
|
@ -745,7 +751,7 @@ namespace OpenSim.Region.Terrain
|
|||
{
|
||||
for (y = 0; y < dimensionY; y++)
|
||||
{
|
||||
tempMap[x,y] = (double)bs.ReadSingle();
|
||||
tempMap[x, y] = (double)bs.ReadSingle();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -762,6 +768,11 @@ namespace OpenSim.Region.Terrain
|
|||
|
||||
tainted++;
|
||||
}
|
||||
finally
|
||||
{
|
||||
fileIOLock.ReleaseMutex();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads a larger tiled image across a terrain
|
||||
|
|
Loading…
Reference in New Issue