From ae7c30a0f38b2b99ceef0a31968b13a76c164211 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Tue, 18 May 2010 00:07:17 -0700 Subject: 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. --- ThirdParty/SmartThreadPool/SmartThreadPool.cs | 13 +++++-------- 1 file 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 // Process until shutdown. while(!_shutdown) { - // Update the last time this thread was seen alive. - // It's good for debugging. - _workerThreads[Thread.CurrentThread] = DateTime.Now; - + // Wait for a work item, shutdown, or timeout WorkItem workItem = Dequeue(); - // Update the last time this thread was seen alive. - // It's good for debugging. - _workerThreads[Thread.CurrentThread] = DateTime.Now; - // On timeout or shut down. if (null == workItem) { @@ -554,6 +547,10 @@ namespace Amib.Threading { lock(_workerThreads.SyncRoot) { + // Update the last time this thread was seen alive. + // It's good for debugging. + _workerThreads[Thread.CurrentThread] = DateTime.Now; + if (_workerThreads.Count > _stpStartInfo.MinWorkerThreads) { // Inform that the thread is quiting and then quit. -- cgit v1.1