From 50a6b71d50f3e837b0af19fb7632c7657ae94f03 Mon Sep 17 00:00:00 2001 From: Ami Bar Date: Fri, 6 Jul 2012 16:42:10 +0300 Subject: [PATCH] Fixed thread creation when queuing many work items at the same time. This solves item 2966 (http://smartthreadpool.codeplex.com/workitem/2966) reported by Raccoon and etichy. --- SmartThreadPool/SmartThreadPool.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SmartThreadPool/SmartThreadPool.cs b/SmartThreadPool/SmartThreadPool.cs index af59014..d26ed19 100644 --- a/SmartThreadPool/SmartThreadPool.cs +++ b/SmartThreadPool/SmartThreadPool.cs @@ -524,7 +524,7 @@ namespace Amib.Threading workItem.WorkItemIsQueued(); // If all the threads are busy then try to create a new one - if ((InUseThreads + WaitingCallbacks) > _workerThreads.Count) + if (_currentWorkItemsCount > _workerThreads.Count) { StartThreads(1); }