STPStartInfo.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // Ami Bar
  2. // [email protected]
  3. using System.Threading;
  4. namespace Amib.Threading
  5. {
  6. /// <summary>
  7. /// Summary description for STPStartInfo.
  8. /// </summary>
  9. public class STPStartInfo : WIGStartInfo
  10. {
  11. /// <summary>
  12. /// Idle timeout in milliseconds.
  13. /// If a thread is idle for _idleTimeout milliseconds then
  14. /// it may quit.
  15. /// </summary>
  16. private int _idleTimeout;
  17. /// <summary>
  18. /// The lower limit of threads in the pool.
  19. /// </summary>
  20. private int _minWorkerThreads;
  21. /// <summary>
  22. /// The upper limit of threads in the pool.
  23. /// </summary>
  24. private int _maxWorkerThreads;
  25. /// <summary>
  26. /// The priority of the threads in the pool
  27. /// </summary>
  28. private ThreadPriority _threadPriority;
  29. /// <summary>
  30. /// The thread pool name. Threads will get names depending on this.
  31. /// </summary>
  32. private string _threadPoolName;
  33. /// <summary>
  34. /// If this field is not null then the performance counters are enabled
  35. /// and use the string as the name of the instance.
  36. /// </summary>
  37. private string _pcInstanceName;
  38. private int _stackSize;
  39. public STPStartInfo() : base()
  40. {
  41. _idleTimeout = SmartThreadPool.DefaultIdleTimeout;
  42. _minWorkerThreads = SmartThreadPool.DefaultMinWorkerThreads;
  43. _maxWorkerThreads = SmartThreadPool.DefaultMaxWorkerThreads;
  44. _threadPriority = SmartThreadPool.DefaultThreadPriority;
  45. _threadPoolName = SmartThreadPool.DefaultThreadPoolName;
  46. _pcInstanceName = SmartThreadPool.DefaultPerformanceCounterInstanceName;
  47. _stackSize = SmartThreadPool.DefaultStackSize;
  48. }
  49. public STPStartInfo(STPStartInfo stpStartInfo) : base(stpStartInfo)
  50. {
  51. _idleTimeout = stpStartInfo._idleTimeout;
  52. _minWorkerThreads = stpStartInfo._minWorkerThreads;
  53. _maxWorkerThreads = stpStartInfo._maxWorkerThreads;
  54. _threadPriority = stpStartInfo._threadPriority;
  55. _threadPoolName = stpStartInfo._threadPoolName;
  56. _pcInstanceName = stpStartInfo._pcInstanceName;
  57. _stackSize = stpStartInfo._stackSize;
  58. }
  59. public int IdleTimeout
  60. {
  61. get { return _idleTimeout; }
  62. set { _idleTimeout = value; }
  63. }
  64. public int MinWorkerThreads
  65. {
  66. get { return _minWorkerThreads; }
  67. set { _minWorkerThreads = value; }
  68. }
  69. public int MaxWorkerThreads
  70. {
  71. get { return _maxWorkerThreads; }
  72. set { _maxWorkerThreads = value; }
  73. }
  74. public ThreadPriority ThreadPriority
  75. {
  76. get { return _threadPriority; }
  77. set { _threadPriority = value; }
  78. }
  79. public virtual string ThreadPoolName
  80. {
  81. get { return _threadPoolName; }
  82. set { _threadPoolName = value; }
  83. }
  84. public string PerformanceCounterInstanceName
  85. {
  86. get { return _pcInstanceName; }
  87. set { _pcInstanceName = value; }
  88. }
  89. public int StackSize
  90. {
  91. get { return _stackSize; }
  92. set { _stackSize = value; }
  93. }
  94. }
  95. }