diff Implab/Parallels/DispatchPool.cs @ 34:dabf79fde388

fixed race condition in DispatchPool
author cin
date Thu, 10 Apr 2014 04:20:25 +0400
parents 2fad2d1f4b03
children 2fc0fbe7d58b
line wrap: on
line diff
--- a/Implab/Parallels/DispatchPool.cs	Thu Apr 10 02:39:29 2014 +0400
+++ b/Implab/Parallels/DispatchPool.cs	Thu Apr 10 04:20:25 2014 +0400
@@ -155,7 +155,7 @@
             }
         }
 
-        private void EnsurePoolIsAlive() {
+        protected void EnsurePoolIsAlive() {
             if (AllocateThreadSlot(1)) {
                 // if there were no threads in the pool
                 var worker = new Thread(this.Worker);
@@ -164,7 +164,7 @@
             }
         }
 
-        private bool Suspend() {
+        protected virtual bool Suspend() {
             //no tasks left, exit if the thread is no longer needed
             bool last;
             bool requestExit;
@@ -295,7 +295,6 @@
                     InvokeUnit(unit);
                     continue;
                 }
-
                 Interlocked.Decrement(ref m_activeThreads);
 
                 // entering suspend state