diff options
author | BlueWall | 2013-06-05 15:08:25 -0400 |
---|---|---|
committer | BlueWall | 2013-06-05 15:08:25 -0400 |
commit | b4f472c4fab5c1b3fda0f86bba330d5bf0800e22 (patch) | |
tree | 4e6c6650a734484c483400641518861f27502bba /OpenSim/Region | |
parent | BulletSim: default PhysicsTimeStep to same as the simulator's (diff) | |
download | opensim-SC-b4f472c4fab5c1b3fda0f86bba330d5bf0800e22.zip opensim-SC-b4f472c4fab5c1b3fda0f86bba330d5bf0800e22.tar.gz opensim-SC-b4f472c4fab5c1b3fda0f86bba330d5bf0800e22.tar.bz2 opensim-SC-b4f472c4fab5c1b3fda0f86bba330d5bf0800e22.tar.xz |
Make locking more uniform
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 5b228ee..7165cb6 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | |||
@@ -62,6 +62,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles | |||
62 | // count. The entries are removed when the interest count reaches 0. | 62 | // count. The entries are removed when the interest count reaches 0. |
63 | Dictionary<UUID,UUID> classifiedCache = new Dictionary<UUID, UUID>(); | 63 | Dictionary<UUID,UUID> classifiedCache = new Dictionary<UUID, UUID>(); |
64 | Dictionary<UUID,int> classifiedInterest = new Dictionary<UUID, int>(); | 64 | Dictionary<UUID,int> classifiedInterest = new Dictionary<UUID, int>(); |
65 | Object classifiedLock; | ||
65 | 66 | ||
66 | public Scene Scene | 67 | public Scene Scene |
67 | { | 68 | { |
@@ -326,14 +327,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles | |||
326 | string name = m["name"].AsString(); | 327 | string name = m["name"].AsString(); |
327 | 328 | ||
328 | classifieds[cid] = name; | 329 | classifieds[cid] = name; |
329 | 330 | ||
330 | if(!classifiedCache.ContainsKey(cid)) | 331 | if(!classifiedCache.ContainsKey(cid)) |
331 | { | 332 | { |
332 | classifiedCache.Add(cid,creatorId); | 333 | // lock(classifiedLock) |
333 | classifiedInterest.Add(cid, 0); | 334 | // { |
335 | lock(classifiedCache) | ||
336 | classifiedCache.Add(cid,creatorId); | ||
337 | lock(classifiedInterest) | ||
338 | classifiedInterest.Add(cid, 0); | ||
339 | // } | ||
334 | } | 340 | } |
335 | 341 | ||
336 | classifiedInterest[cid] ++; | 342 | lock(classifiedInterest) |
343 | classifiedInterest[cid] ++; | ||
337 | } | 344 | } |
338 | 345 | ||
339 | remoteClient.SendAvatarClassifiedReply(new UUID(args[0]), classifieds); | 346 | remoteClient.SendAvatarClassifiedReply(new UUID(args[0]), classifieds); |
@@ -346,22 +353,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles | |||
346 | ad.ClassifiedId = queryClassifiedID; | 353 | ad.ClassifiedId = queryClassifiedID; |
347 | 354 | ||
348 | if(classifiedCache.ContainsKey(queryClassifiedID)) | 355 | if(classifiedCache.ContainsKey(queryClassifiedID)) |
349 | { | 356 | { |
350 | target = classifiedCache[queryClassifiedID]; | 357 | target = classifiedCache[queryClassifiedID]; |
351 | 358 | ||
352 | if(classifiedInterest[queryClassifiedID] -- == 0) | 359 | lock(classifiedInterest) |
360 | classifiedInterest[queryClassifiedID] --; | ||
361 | |||
362 | if(classifiedInterest[queryClassifiedID] == 0) | ||
353 | { | 363 | { |
364 | lock(classifiedInterest) | ||
365 | classifiedInterest.Remove(queryClassifiedID); | ||
354 | lock(classifiedCache) | 366 | lock(classifiedCache) |
355 | { | ||
356 | lock(classifiedInterest) | ||
357 | { | ||
358 | classifiedInterest.Remove(queryClassifiedID); | ||
359 | } | ||
360 | classifiedCache.Remove(queryClassifiedID); | 367 | classifiedCache.Remove(queryClassifiedID); |
361 | } | ||
362 | } | 368 | } |
363 | } | 369 | } |
364 | |||
365 | 370 | ||
366 | string serverURI = string.Empty; | 371 | string serverURI = string.Empty; |
367 | bool foreign = GetUserProfileServerURI(target, out serverURI); | 372 | bool foreign = GetUserProfileServerURI(target, out serverURI); |