Added mutex instead of lock for update

0.1-prestable
Adam Frisby 2007-04-22 18:51:03 +00:00
parent 2194b74473
commit d82466ec82
1 changed files with 41 additions and 41 deletions

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Reflection; using System.Reflection;
using System.IO; using System.IO;
using System.Threading;
using OpenSim.Physics.Manager; using OpenSim.Physics.Manager;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Assets; using OpenSim.Framework.Assets;
@ -41,7 +42,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 Object updateLock; private Mutex 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.
@ -53,7 +54,7 @@ namespace OpenSim.world
{ {
try try
{ {
updateLock = null; updateLock = new Mutex(false);
m_clientThreads = clientThreads; m_clientThreads = clientThreads;
m_regionHandle = regionHandle; m_regionHandle = regionHandle;
m_regionName = regionName; m_regionName = regionName;
@ -185,8 +186,7 @@ namespace OpenSim.world
/// </summary> /// </summary>
public void Update() public void Update()
{ {
lock (updateLock) updateLock.WaitOne();
{
try try
{ {
if (this.phyScene.IsThreaded) if (this.phyScene.IsThreaded)
@ -230,7 +230,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());
} }
} updateLock.ReleaseMutex();
} }
/// <summary> /// <summary>