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