aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ThirdParty/SmartThreadPool/SmartThreadPool.cs
diff options
context:
space:
mode:
authorTom Grimshaw2010-05-18 00:07:17 -0700
committerTom Grimshaw2010-05-18 00:07:17 -0700
commitae7c30a0f38b2b99ceef0a31968b13a76c164211 (patch)
tree8432d49aa2db50cc738a6f1ebc16ac6e97bbd48d /ThirdParty/SmartThreadPool/SmartThreadPool.cs
parentPrevent an "index out of range" error on login (diff)
downloadopensim-SC_OLD-ae7c30a0f38b2b99ceef0a31968b13a76c164211.zip
opensim-SC_OLD-ae7c30a0f38b2b99ceef0a31968b13a76c164211.tar.gz
opensim-SC_OLD-ae7c30a0f38b2b99ceef0a31968b13a76c164211.tar.bz2
opensim-SC_OLD-ae7c30a0f38b2b99ceef0a31968b13a76c164211.tar.xz
While examining our 10,10,10 issue I discovered that several threads were locked with each other in an unusual place; I've moved the piece of code inside a lock[] context and so far it's looking promising.
Diffstat (limited to 'ThirdParty/SmartThreadPool/SmartThreadPool.cs')
-rw-r--r--ThirdParty/SmartThreadPool/SmartThreadPool.cs13
1 files changed, 5 insertions, 8 deletions
diff --git a/ThirdParty/SmartThreadPool/SmartThreadPool.cs b/ThirdParty/SmartThreadPool/SmartThreadPool.cs
index bd52f62..8c9d38b 100644
--- a/ThirdParty/SmartThreadPool/SmartThreadPool.cs
+++ b/ThirdParty/SmartThreadPool/SmartThreadPool.cs
@@ -535,17 +535,10 @@ namespace Amib.Threading
535 // Process until shutdown. 535 // Process until shutdown.
536 while(!_shutdown) 536 while(!_shutdown)
537 { 537 {
538 // Update the last time this thread was seen alive. 538
539 // It's good for debugging.
540 _workerThreads[Thread.CurrentThread] = DateTime.Now;
541
542 // Wait for a work item, shutdown, or timeout 539 // Wait for a work item, shutdown, or timeout
543 WorkItem workItem = Dequeue(); 540 WorkItem workItem = Dequeue();
544 541
545 // Update the last time this thread was seen alive.
546 // It's good for debugging.
547 _workerThreads[Thread.CurrentThread] = DateTime.Now;
548
549 // On timeout or shut down. 542 // On timeout or shut down.
550 if (null == workItem) 543 if (null == workItem)
551 { 544 {
@@ -554,6 +547,10 @@ namespace Amib.Threading
554 { 547 {
555 lock(_workerThreads.SyncRoot) 548 lock(_workerThreads.SyncRoot)
556 { 549 {
550 // Update the last time this thread was seen alive.
551 // It's good for debugging.
552 _workerThreads[Thread.CurrentThread] = DateTime.Now;
553
557 if (_workerThreads.Count > _stpStartInfo.MinWorkerThreads) 554 if (_workerThreads.Count > _stpStartInfo.MinWorkerThreads)
558 { 555 {
559 // Inform that the thread is quiting and then quit. 556 // Inform that the thread is quiting and then quit.