aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs36
1 files changed, 27 insertions, 9 deletions
diff --git a/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs b/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs
index 73d0d20..ec26b43 100644
--- a/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs
+++ b/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs
@@ -477,30 +477,48 @@ namespace OpenSim.Framework
477 477
478 public TValue[] GetArray() 478 public TValue[] GetArray()
479 { 479 {
480 TValue[] ret = new TValue[0]; 480 bool gotupLock = false;
481 bool gotLock = false;
482 try 481 try
483 { 482 {
484 try { } 483 try { }
485 finally 484 finally
486 { 485 {
487 rwLock.EnterWriteLock(); 486 rwLock.EnterUpgradeableReadLock();
488 gotLock = true; 487 gotupLock = true;
488 }
489 489
490 if (m_array == null) 490 if (m_array == null)
491 {
492 bool gotwritelock = false;
493 try
491 { 494 {
495 try { }
496 finally
497 {
498 rwLock.EnterWriteLock();
499 gotwritelock = true;
500 }
501
492 m_array = new TValue[Dictionary1.Count]; 502 m_array = new TValue[Dictionary1.Count];
493 Dictionary1.Values.CopyTo(m_array, 0); 503 Dictionary1.Values.CopyTo(m_array, 0);
494 } 504 }
495 ret = m_array; 505 finally
506 {
507 if (gotwritelock)
508 rwLock.ExitWriteLock();
509 }
496 } 510 }
511 return m_array;
512 }
513 catch
514 {
515 return new TValue[0];
497 } 516 }
498 finally 517 finally
499 { 518 {
500 if (gotLock) 519 if (gotupLock)
501 rwLock.ExitWriteLock(); 520 rwLock.ExitUpgradeableReadLock();
502 } 521 }
503 return ret;
504 } 522 }
505 } 523 }
506} \ No newline at end of file 524} \ No newline at end of file