Mercurial > pub > ImplabNet
diff Implab/Parallels/WorkerPool.cs @ 21:6a56df4ec59e promises
DispatchPool works again, but performance is poor in some cases
author | cin |
---|---|
date | Tue, 12 Nov 2013 19:52:10 +0400 |
parents | 1c3b3d518480 |
children | dabf79fde388 |
line wrap: on
line diff
--- a/Implab/Parallels/WorkerPool.cs Tue Nov 12 02:27:22 2013 +0400 +++ b/Implab/Parallels/WorkerPool.cs Tue Nov 12 19:52:10 2013 +0400 @@ -57,15 +57,8 @@ var len = Interlocked.Increment(ref m_queueLength); m_queue.Enqueue(unit); - ExtendPool(); - } - - protected override bool ExtendPool() { - if (m_queueLength <= m_threshold*ActiveThreads) - // 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) { @@ -80,11 +73,5 @@ unit(); } - protected override bool Suspend() { - if (m_queueLength == 0) - return base.Suspend(); - else - return true; // spin again without locks... - } } }