aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
diff options
context:
space:
mode:
authorCasperW2009-11-24 18:02:12 +0100
committerCasperW2009-11-24 18:02:12 +0100
commitd1147136946daf14724183b3191119be44ff8b16 (patch)
treefd5c056348acdd0ea82f4c797d15bcae3336ee28 /OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
parentSwap the locking of m_EventQueue and m_Script to ease locks on script invento... (diff)
downloadopensim-SC_OLD-d1147136946daf14724183b3191119be44ff8b16.zip
opensim-SC_OLD-d1147136946daf14724183b3191119be44ff8b16.tar.gz
opensim-SC_OLD-d1147136946daf14724183b3191119be44ff8b16.tar.bz2
opensim-SC_OLD-d1147136946daf14724183b3191119be44ff8b16.tar.xz
Drop all locking of part.TaskInventory in favour of a ReaderWriterLockSlim lock handler. This gives us:
- Faster prim inventory actions. Multiple threads can read at once. - Fixes the known prim inventory thread locks - In the event of a thread lock occurring, it will usually self heal after sixty seconds with an error message in the console
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs22
1 files changed, 11 insertions, 11 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 063d50f..0f4a9ad 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -238,13 +238,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
238 238
239 if (part != null) 239 if (part != null)
240 { 240 {
241 lock (part.TaskInventory) 241 part.TaskInventory.LockItemsForRead(true);
242 if (part.TaskInventory.ContainsKey(m_ItemID))
242 { 243 {
243 if (part.TaskInventory.ContainsKey(m_ItemID)) 244 m_thisScriptTask = part.TaskInventory[m_ItemID];
244 {
245 m_thisScriptTask = part.TaskInventory[m_ItemID];
246 }
247 } 245 }
246 part.TaskInventory.LockItemsForRead(false);
248 } 247 }
249 248
250 ApiManager am = new ApiManager(); 249 ApiManager am = new ApiManager();
@@ -429,14 +428,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
429 { 428 {
430 int permsMask; 429 int permsMask;
431 UUID permsGranter; 430 UUID permsGranter;
432 lock (part.TaskInventory) 431 part.TaskInventory.LockItemsForRead(true);
432 if (!part.TaskInventory.ContainsKey(m_ItemID))
433 { 433 {
434 if (!part.TaskInventory.ContainsKey(m_ItemID)) 434 part.TaskInventory.LockItemsForRead(false);
435 return; 435 return;
436
437 permsGranter = part.TaskInventory[m_ItemID].PermsGranter;
438 permsMask = part.TaskInventory[m_ItemID].PermsMask;
439 } 436 }
437 permsGranter = part.TaskInventory[m_ItemID].PermsGranter;
438 permsMask = part.TaskInventory[m_ItemID].PermsMask;
439 part.TaskInventory.LockItemsForRead(false);
440 440
441 if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) 441 if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
442 { 442 {