diff --git a/Docs/SmartThreadPool.html b/Docs/SmartThreadPool.html index e3733b0..a7d3a8b 100644 --- a/Docs/SmartThreadPool.html +++ b/Docs/SmartThreadPool.html @@ -220,7 +220,7 @@ smartThreadPool.QueueWorkItem(System.IO.File.Copy,

I decided to add a new thread every time a new work item is queued and all the threads in the pool are busy. The formula for adding a new thread can be summarized to:

-
(InUseThreads + WaitingCallbacks) > WorkerThreads
+
_currentWorkItemsCount > WorkerThreads

where WorkerThreads is the current number of threads in the pool, InUseThreads is the number of threads in the pool that are currently working on a work item, and WaitingCallbacks is the number of waiting work items. (Thanks to jrshute for the comment.)

@@ -236,7 +236,7 @@ smartThreadPool.QueueWorkItem(System.IO.File.Copy, // If all the threads are busy then try // to create a new one - if ((InUseThreads + WaitingCallbacks) > _workerThreads.Count) + if (_currentWorkItemsCount > _workerThreads.Count) { StartThreads(1); } @@ -526,9 +526,9 @@ public delegate TResult Func<T1, T2, T3, T4>(T1 arg1, /// Returns the user-defined object /// that was provided in the QueueWorkItem. - /// If the work item callback is Action<...> - /// or Func<...> the State value - /// depends on the WIGStartInfo.FillStateWithArgs. + /// If the work item callback is Action<...> + /// or Func<...> the State value + /// depends on the WIGStartInfo.FillStateWithArgs. object State { get; } /// Cancel the work item execution. @@ -539,8 +539,8 @@ public delegate TResult Func<T1, T2, T3, T4>(T1 arg1, /// the result of the work item is cancelled. /// (See the work item canceling section for more information) /// Param: abortExecution - When true send an AbortException - /// to the executing thread.</param> - /// Returns true if the work item + /// to the executing thread.</param> + /// Returns true if the work item /// was not completed, otherwise false. bool Cancel(bool abortExecution); @@ -949,7 +949,7 @@ void Print(Printer printer, Document document) {...}
  • Threads have priority.
  • -

    STPStartInfo contains a property that defines the priority in which the threads are started in the SmartThreadPool. Use it if you know what you are doing. Playing with threads priority may end up with dead locks, live lock, and days locked :-(.

    +

    STPStartInfo contains a property that defines the priority in which the threads are started in the SmartThreadPool. Use it if you know what you are doing. Playing with threads priority may end up with dead locks, live lock, and days locked Frown | :-( .

  • MaxThreads/MinThreads/Concurrency can be changed at run time.