* Added static mutex to terrain load-tile to prevent file IO locking issues.

afrisby
Adam Frisby 2007-10-25 15:17:42 +00:00
parent 2048d611cf
commit 6804f9affb
1 changed files with 37 additions and 26 deletions

View File

@ -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);
@ -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