diff Implab/Parallels/WorkerPool.cs @ 23:f0568ff069a5

Слияние с promises
author cin
date Wed, 13 Nov 2013 14:03:20 +0400
parents 6a56df4ec59e
children dabf79fde388
line wrap: on
line diff
--- a/Implab/Parallels/WorkerPool.cs	Fri Nov 08 01:27:04 2013 +0400
+++ b/Implab/Parallels/WorkerPool.cs	Wed Nov 13 14:03:20 2013 +0400
@@ -57,16 +57,8 @@
             var len = Interlocked.Increment(ref m_queueLength);
             m_queue.Enqueue(unit);
 
-            if(!ExtendPool())
-                WakePool();
-        }
-
-        protected override bool ExtendPool() {
-            if (m_queueLength <= m_threshold*ThreadCount)
-                // in this case we are in active thread and it request for additional workers
-                // satisfy it only when queue is longer than threshold
-                return false;
-            return base.ExtendPool();
+            if (len > m_threshold*ActiveThreads)
+                GrowPool();
         }
 
         protected override bool TryDequeue(out Action unit) {
@@ -81,9 +73,5 @@
             unit();
         }
 
-        protected override void Suspend() {
-            if (m_queueLength == 0)
-                base.Suspend();
-        }
     }
 }