diff --git a/ThirdParty/SmartThreadPool/SmartThreadPool.cs b/ThirdParty/SmartThreadPool/SmartThreadPool.cs index bd52f6245a..8c9d38bce5 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.