Added lock around World.Update to prevent multiple updates occuring simultaneously (it happened!)

0.1-prestable
Adam Frisby 2007-04-22 18:00:01 +00:00
parent 869b39c451
commit 6103e06a34
1 changed files with 37 additions and 32 deletions

View File

@ -41,6 +41,7 @@ namespace OpenSim.world
private string m_regionName; private string m_regionName;
private InventoryCache _inventoryCache; private InventoryCache _inventoryCache;
private AssetCache _assetCache; private AssetCache _assetCache;
private int updateLock;
/// <summary> /// <summary>
/// Creates a new World class, and a region to go with it. /// Creates a new World class, and a region to go with it.
@ -52,6 +53,7 @@ namespace OpenSim.world
{ {
try try
{ {
updateLock = 0;
m_clientThreads = clientThreads; m_clientThreads = clientThreads;
m_regionHandle = regionHandle; m_regionHandle = regionHandle;
m_regionName = regionName; m_regionName = regionName;
@ -182,6 +184,8 @@ namespace OpenSim.world
/// Performs per-frame updates on the world, this should be the central world loop /// Performs per-frame updates on the world, this should be the central world loop
/// </summary> /// </summary>
public void Update() public void Update()
{
lock (updateLock)
{ {
try try
{ {
@ -227,6 +231,7 @@ namespace OpenSim.world
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: Update() - Failed with exception " + e.ToString()); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: Update() - Failed with exception " + e.ToString());
} }
} }
}
/// <summary> /// <summary>
/// Loads a new storage subsystem from a named library /// Loads a new storage subsystem from a named library