aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorUbitUmarov2012-09-01 02:05:28 +0100
committerUbitUmarov2012-09-01 02:05:28 +0100
commit63e6666f2216a34da8327bcd94f94c4ed6c2b254 (patch)
tree98339a58b2e7d92c7a60c6baab58617941a60804 /OpenSim/Region/CoreModules
parentMerge branch 'avination' into ubitwork (diff)
downloadopensim-SC_OLD-63e6666f2216a34da8327bcd94f94c4ed6c2b254.zip
opensim-SC_OLD-63e6666f2216a34da8327bcd94f94c4ed6c2b254.tar.gz
opensim-SC_OLD-63e6666f2216a34da8327bcd94f94c4ed6c2b254.tar.bz2
opensim-SC_OLD-63e6666f2216a34da8327bcd94f94c4ed6c2b254.tar.xz
try to reduce potencial recursive locking
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs77
1 files changed, 51 insertions, 26 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 51dcb67..8bc81ae 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -86,7 +86,10 @@ namespace OpenSim.Region.CoreModules.World.Land
86 /// <value> 86 /// <value>
87 /// Land objects keyed by local id 87 /// Land objects keyed by local id
88 /// </value> 88 /// </value>
89 private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); 89// private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
90
91 //ubit: removed the readonly so i can move it around
92 private Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
90 93
91 private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; 94 private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
92 95
@@ -242,15 +245,19 @@ namespace OpenSim.Region.CoreModules.World.Land
242 { 245 {
243 LandData newData = data.Copy(); 246 LandData newData = data.Copy();
244 newData.LocalID = local_id; 247 newData.LocalID = local_id;
248 ILandObject landobj = null;
245 249
246 lock (m_landList) 250 lock (m_landList)
247 { 251 {
248 if (m_landList.ContainsKey(local_id)) 252 if (m_landList.ContainsKey(local_id))
249 { 253 {
250 m_landList[local_id].LandData = newData; 254 m_landList[local_id].LandData = newData;
251 m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, m_landList[local_id]); 255 landobj = m_landList[local_id];
256// m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, m_landList[local_id]);
252 } 257 }
253 } 258 }
259 if(landobj != null)
260 m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, landobj);
254 } 261 }
255 262
256 public bool AllowedForcefulBans 263 public bool AllowedForcefulBans
@@ -280,14 +287,14 @@ namespace OpenSim.Region.CoreModules.World.Land
280 protected ILandObject CreateDefaultParcel() 287 protected ILandObject CreateDefaultParcel()
281 { 288 {
282 m_log.DebugFormat( 289 m_log.DebugFormat(
283 "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); 290 "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName);
284 291
285 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); 292 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
286 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); 293 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
287 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 294 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
288 fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); 295 fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
289 296
290 return AddLandObject(fullSimParcel); 297 return AddLandObject(fullSimParcel);
291 } 298 }
292 299
293 public List<ILandObject> AllParcels() 300 public List<ILandObject> AllParcels()
@@ -617,21 +624,28 @@ namespace OpenSim.Region.CoreModules.World.Land
617 /// </summary> 624 /// </summary>
618 public void Clear(bool setupDefaultParcel) 625 public void Clear(bool setupDefaultParcel)
619 { 626 {
627 Dictionary<int, ILandObject> landworkList;
628 // move to work pointer since we are deleting it all
620 lock (m_landList) 629 lock (m_landList)
621 { 630 {
622 foreach (ILandObject lo in m_landList.Values) 631 landworkList = m_landList;
623 { 632 m_landList = new Dictionary<int, ILandObject>();
624 //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); 633 }
625 m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID);
626 }
627 634
628 m_landList.Clear(); 635 // this 2 methods have locks (now)
636 ResetSimLandObjects();
629 637
630 ResetSimLandObjects(); 638 if (setupDefaultParcel)
639 CreateDefaultParcel();
631 640
632 if (setupDefaultParcel) 641 // fire outside events unlocked
633 CreateDefaultParcel(); 642 foreach (ILandObject lo in landworkList.Values)
643 {
644 //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID);
645 m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID);
634 } 646 }
647 landworkList.Clear();
648
635 } 649 }
636 650
637 private void performFinalLandJoin(ILandObject master, ILandObject slave) 651 private void performFinalLandJoin(ILandObject master, ILandObject slave)
@@ -1324,20 +1338,30 @@ namespace OpenSim.Region.CoreModules.World.Land
1324 1338
1325 public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) 1339 public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data)
1326 { 1340 {
1341 Dictionary<int, ILandObject> landworkList;
1342 // move to work pointer since we are deleting it all
1343 lock (m_landList)
1344 {
1345 landworkList = m_landList;
1346 m_landList = new Dictionary<int, ILandObject>();
1347 }
1348
1349 //Remove all the land objects in the sim and then process our new data
1350 foreach (int n in landworkList.Keys)
1351 {
1352 m_scene.EventManager.TriggerLandObjectRemoved(landworkList[n].LandData.GlobalID);
1353 }
1354 landworkList.Clear();
1355
1327 lock (m_landList) 1356 lock (m_landList)
1328 { 1357 {
1329 //Remove all the land objects in the sim and then process our new data
1330 foreach (int n in m_landList.Keys)
1331 {
1332 m_scene.EventManager.TriggerLandObjectRemoved(m_landList[n].LandData.GlobalID);
1333 }
1334 m_landIDList.Initialize(); 1358 m_landIDList.Initialize();
1335 m_landList.Clear(); 1359 m_landList.Clear();
1360 }
1336 1361
1337 for (int i = 0; i < data.Count; i++) 1362 for (int i = 0; i < data.Count; i++)
1338 { 1363 {
1339 IncomingLandObjectFromStorage(data[i]); 1364 IncomingLandObjectFromStorage(data[i]);
1340 }
1341 } 1365 }
1342 } 1366 }
1343 1367
@@ -1366,7 +1390,8 @@ namespace OpenSim.Region.CoreModules.World.Land
1366 1390
1367 public void EventManagerOnNoLandDataFromStorage() 1391 public void EventManagerOnNoLandDataFromStorage()
1368 { 1392 {
1369 lock (m_landList) 1393 // called methods already have locks
1394// lock (m_landList)
1370 { 1395 {
1371 ResetSimLandObjects(); 1396 ResetSimLandObjects();
1372 CreateDefaultParcel(); 1397 CreateDefaultParcel();