diff --git a/Docs/SmartThreadPool.html b/Docs/SmartThreadPool.html index dddd506..91bcbcd 100644 --- a/Docs/SmartThreadPool.html +++ b/Docs/SmartThreadPool.html @@ -48,6 +48,14 @@ Performance Counters (Windows & internal)
  • Work Item timeout (passive)
  • +
  • + Threads ApartmentState
  • +
  • + Threads IsBakcground
  • +
  • + Threads name template
  • +
  • + Windows Phone is supported (limited)
  • Why do you need a thread pool?

    @@ -109,6 +117,15 @@
    1. Added work item timeout (passive).
    + +

    + New features added in August 2012

    +
      +
    1. Enabled to set threads IsBackground.
    2. +
    3. Enabled to set threads ApartmentState.
    4. +
    5. Added support fore Windows Phone (limited).
    6. +
    +

    What about the .NET ThreadPool?

    The Windows system provides one .NET ThreadPool for each process. The .NET ThreadPool can contain up to 25 (by default) threads per processor. It is also stated that the operations in .NET ThreadPool should be quick to avoid suspension of the work of others who use the .NET ThreadPool. Note that several AppDomains in the same process share the same .NET ThreadPool. If you want a thread to work for a long period of time, then the .NET ThreadPool is not a good choice for you (unless you know what you are doing). Note that each asynchronous method call from the .NET Framework that begins with "Begin…" (e.g., BeginInvoke, BeginSend, BeginReceive, etc.) uses the .NET ThreadPool to run its callback. Also note that the .NET ThreadPool doesn't support calls to COM with single threaded apartment (STA), since the ThreadPool @@ -764,8 +781,24 @@ to simplfy the initiation of a parallel task.

    automatically if it didn't complete. The cancel works the same as a call to Cancel with the abortExecution argument set to false (This is why the timeout is passive).

    To sample the cancel use SmartThreadPool.IsWorkItemCanceled which is a static property, or you can use SmartThreadPool.AbortOnWorkItemCancel which check if the current work item is cancelled and if so abort the thread (Thread.CurrentThread.Abort()).

    -See timeout example below +See timeout example below

    +
  • Enabled to set threads IsBackground
  • +

    This featue enables to set the IsBackground of the STP threads. The default is true.

    +

    To use it:
    + STPStartInfo stpStartInfo = new STPStartInfo();
    + stpStartInfo.AreThreadsBackground = false;

    +
  • Enabled to set threads ApartmentState
  • +

    This featue enables to set the ApartmentState of the STP threads. The default is not to set.

    +

    To use it:
    + STPStartInfo stpStartInfo = new STPStartInfo();
    + stpStartInfo.ApartmentState = ApartmentState.MTA;
    +

    +
  • Support Windows Phone (limited)
  • +

    Add reference to SmartThreadPoolWP.dll in your code and use it.

    +

    + +

    When to use?

    The Smart Thread Pool is good when your work items don't do too much, but wait for events, IOs, sockets, etc. This means that the work items don't use CPU, but run for a long time. It is also good when you don't need to keep alive too many threads in the air all the time. If your work items do a short time work, then use the .NET ThreadPool. If you have a constant heavy load of work, then use Toub's thread pool and define the maximum number of threads accordingly.

    @@ -1405,16 +1438,27 @@ public class TimeoutExample
  • 7th April 2009: Changes
  • 21st December 2009: Changes +
  • +
  • 20 August 2012: Changes +
  • diff --git a/Docs/WindowsPhone.png b/Docs/WindowsPhone.png new file mode 100644 index 0000000..203c571 Binary files /dev/null and b/Docs/WindowsPhone.png differ