aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ThirdParty/SmartThreadPool/STPStartInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ThirdParty/SmartThreadPool/STPStartInfo.cs')
-rw-r--r--ThirdParty/SmartThreadPool/STPStartInfo.cs424
1 files changed, 212 insertions, 212 deletions
diff --git a/ThirdParty/SmartThreadPool/STPStartInfo.cs b/ThirdParty/SmartThreadPool/STPStartInfo.cs
index 2ec8dc6..96fa094 100644
--- a/ThirdParty/SmartThreadPool/STPStartInfo.cs
+++ b/ThirdParty/SmartThreadPool/STPStartInfo.cs
@@ -1,212 +1,212 @@
1using System; 1using System;
2using System.Threading; 2using System.Threading;
3 3
4namespace Amib.Threading 4namespace Amib.Threading
5{ 5{
6 /// <summary> 6 /// <summary>
7 /// Summary description for STPStartInfo. 7 /// Summary description for STPStartInfo.
8 /// </summary> 8 /// </summary>
9 public class STPStartInfo : WIGStartInfo 9 public class STPStartInfo : WIGStartInfo
10 { 10 {
11 private int _idleTimeout = SmartThreadPool.DefaultIdleTimeout; 11 private int _idleTimeout = SmartThreadPool.DefaultIdleTimeout;
12 private int _minWorkerThreads = SmartThreadPool.DefaultMinWorkerThreads; 12 private int _minWorkerThreads = SmartThreadPool.DefaultMinWorkerThreads;
13 private int _maxWorkerThreads = SmartThreadPool.DefaultMaxWorkerThreads; 13 private int _maxWorkerThreads = SmartThreadPool.DefaultMaxWorkerThreads;
14#if !(WINDOWS_PHONE) 14#if !(WINDOWS_PHONE)
15 private ThreadPriority _threadPriority = SmartThreadPool.DefaultThreadPriority; 15 private ThreadPriority _threadPriority = SmartThreadPool.DefaultThreadPriority;
16#endif 16#endif
17 private string _performanceCounterInstanceName = SmartThreadPool.DefaultPerformanceCounterInstanceName; 17 private string _performanceCounterInstanceName = SmartThreadPool.DefaultPerformanceCounterInstanceName;
18 private bool _areThreadsBackground = SmartThreadPool.DefaultAreThreadsBackground; 18 private bool _areThreadsBackground = SmartThreadPool.DefaultAreThreadsBackground;
19 private bool _enableLocalPerformanceCounters; 19 private bool _enableLocalPerformanceCounters;
20 private string _threadPoolName = SmartThreadPool.DefaultThreadPoolName; 20 private string _threadPoolName = SmartThreadPool.DefaultThreadPoolName;
21 private int? _maxStackSize = SmartThreadPool.DefaultMaxStackSize; 21 private int? _maxStackSize = SmartThreadPool.DefaultMaxStackSize;
22 22
23 public STPStartInfo() 23 public STPStartInfo()
24 { 24 {
25 _performanceCounterInstanceName = SmartThreadPool.DefaultPerformanceCounterInstanceName; 25 _performanceCounterInstanceName = SmartThreadPool.DefaultPerformanceCounterInstanceName;
26#if !(WINDOWS_PHONE) 26#if !(WINDOWS_PHONE)
27 _threadPriority = SmartThreadPool.DefaultThreadPriority; 27 _threadPriority = SmartThreadPool.DefaultThreadPriority;
28#endif 28#endif
29 _maxWorkerThreads = SmartThreadPool.DefaultMaxWorkerThreads; 29 _maxWorkerThreads = SmartThreadPool.DefaultMaxWorkerThreads;
30 _idleTimeout = SmartThreadPool.DefaultIdleTimeout; 30 _idleTimeout = SmartThreadPool.DefaultIdleTimeout;
31 _minWorkerThreads = SmartThreadPool.DefaultMinWorkerThreads; 31 _minWorkerThreads = SmartThreadPool.DefaultMinWorkerThreads;
32 } 32 }
33 33
34 public STPStartInfo(STPStartInfo stpStartInfo) 34 public STPStartInfo(STPStartInfo stpStartInfo)
35 : base(stpStartInfo) 35 : base(stpStartInfo)
36 { 36 {
37 _idleTimeout = stpStartInfo.IdleTimeout; 37 _idleTimeout = stpStartInfo.IdleTimeout;
38 _minWorkerThreads = stpStartInfo.MinWorkerThreads; 38 _minWorkerThreads = stpStartInfo.MinWorkerThreads;
39 _maxWorkerThreads = stpStartInfo.MaxWorkerThreads; 39 _maxWorkerThreads = stpStartInfo.MaxWorkerThreads;
40#if !(WINDOWS_PHONE) 40#if !(WINDOWS_PHONE)
41 _threadPriority = stpStartInfo.ThreadPriority; 41 _threadPriority = stpStartInfo.ThreadPriority;
42#endif 42#endif
43 _performanceCounterInstanceName = stpStartInfo.PerformanceCounterInstanceName; 43 _performanceCounterInstanceName = stpStartInfo.PerformanceCounterInstanceName;
44 _enableLocalPerformanceCounters = stpStartInfo._enableLocalPerformanceCounters; 44 _enableLocalPerformanceCounters = stpStartInfo._enableLocalPerformanceCounters;
45 _threadPoolName = stpStartInfo._threadPoolName; 45 _threadPoolName = stpStartInfo._threadPoolName;
46 _areThreadsBackground = stpStartInfo.AreThreadsBackground; 46 _areThreadsBackground = stpStartInfo.AreThreadsBackground;
47#if !(_SILVERLIGHT) && !(WINDOWS_PHONE) 47#if !(_SILVERLIGHT) && !(WINDOWS_PHONE)
48 _apartmentState = stpStartInfo._apartmentState; 48 _apartmentState = stpStartInfo._apartmentState;
49#endif 49#endif
50 } 50 }
51 51
52 /// <summary> 52 /// <summary>
53 /// Get/Set the idle timeout in milliseconds. 53 /// Get/Set the idle timeout in milliseconds.
54 /// If a thread is idle (starved) longer than IdleTimeout then it may quit. 54 /// If a thread is idle (starved) longer than IdleTimeout then it may quit.
55 /// </summary> 55 /// </summary>
56 public virtual int IdleTimeout 56 public virtual int IdleTimeout
57 { 57 {
58 get { return _idleTimeout; } 58 get { return _idleTimeout; }
59 set 59 set
60 { 60 {
61 ThrowIfReadOnly(); 61 ThrowIfReadOnly();
62 _idleTimeout = value; 62 _idleTimeout = value;
63 } 63 }
64 } 64 }
65 65
66 66
67 /// <summary> 67 /// <summary>
68 /// Get/Set the lower limit of threads in the pool. 68 /// Get/Set the lower limit of threads in the pool.
69 /// </summary> 69 /// </summary>
70 public virtual int MinWorkerThreads 70 public virtual int MinWorkerThreads
71 { 71 {
72 get { return _minWorkerThreads; } 72 get { return _minWorkerThreads; }
73 set 73 set
74 { 74 {
75 ThrowIfReadOnly(); 75 ThrowIfReadOnly();
76 _minWorkerThreads = value; 76 _minWorkerThreads = value;
77 } 77 }
78 } 78 }
79 79
80 80
81 /// <summary> 81 /// <summary>
82 /// Get/Set the upper limit of threads in the pool. 82 /// Get/Set the upper limit of threads in the pool.
83 /// </summary> 83 /// </summary>
84 public virtual int MaxWorkerThreads 84 public virtual int MaxWorkerThreads
85 { 85 {
86 get { return _maxWorkerThreads; } 86 get { return _maxWorkerThreads; }
87 set 87 set
88 { 88 {
89 ThrowIfReadOnly(); 89 ThrowIfReadOnly();
90 _maxWorkerThreads = value; 90 _maxWorkerThreads = value;
91 } 91 }
92 } 92 }
93 93
94#if !(WINDOWS_PHONE) 94#if !(WINDOWS_PHONE)
95 /// <summary> 95 /// <summary>
96 /// Get/Set the scheduling priority of the threads in the pool. 96 /// Get/Set the scheduling priority of the threads in the pool.
97 /// The Os handles the scheduling. 97 /// The Os handles the scheduling.
98 /// </summary> 98 /// </summary>
99 public virtual ThreadPriority ThreadPriority 99 public virtual ThreadPriority ThreadPriority
100 { 100 {
101 get { return _threadPriority; } 101 get { return _threadPriority; }
102 set 102 set
103 { 103 {
104 ThrowIfReadOnly(); 104 ThrowIfReadOnly();
105 _threadPriority = value; 105 _threadPriority = value;
106 } 106 }
107 } 107 }
108#endif 108#endif
109 /// <summary> 109 /// <summary>
110 /// Get/Set the thread pool name. Threads will get names depending on this. 110 /// Get/Set the thread pool name. Threads will get names depending on this.
111 /// </summary> 111 /// </summary>
112 public virtual string ThreadPoolName { 112 public virtual string ThreadPoolName {
113 get { return _threadPoolName; } 113 get { return _threadPoolName; }
114 set 114 set
115 { 115 {
116 ThrowIfReadOnly (); 116 ThrowIfReadOnly ();
117 _threadPoolName = value; 117 _threadPoolName = value;
118 } 118 }
119 } 119 }
120 120
121 /// <summary> 121 /// <summary>
122 /// Get/Set the performance counter instance name of this SmartThreadPool 122 /// Get/Set the performance counter instance name of this SmartThreadPool
123 /// The default is null which indicate not to use performance counters at all. 123 /// The default is null which indicate not to use performance counters at all.
124 /// </summary> 124 /// </summary>
125 public virtual string PerformanceCounterInstanceName 125 public virtual string PerformanceCounterInstanceName
126 { 126 {
127 get { return _performanceCounterInstanceName; } 127 get { return _performanceCounterInstanceName; }
128 set 128 set
129 { 129 {
130 ThrowIfReadOnly(); 130 ThrowIfReadOnly();
131 _performanceCounterInstanceName = value; 131 _performanceCounterInstanceName = value;
132 } 132 }
133 } 133 }
134 134
135 /// <summary> 135 /// <summary>
136 /// Enable/Disable the local performance counter. 136 /// Enable/Disable the local performance counter.
137 /// This enables the user to get some performance information about the SmartThreadPool 137 /// This enables the user to get some performance information about the SmartThreadPool
138 /// without using Windows performance counters. (Useful on WindowsCE, Silverlight, etc.) 138 /// without using Windows performance counters. (Useful on WindowsCE, Silverlight, etc.)
139 /// The default is false. 139 /// The default is false.
140 /// </summary> 140 /// </summary>
141 public virtual bool EnableLocalPerformanceCounters 141 public virtual bool EnableLocalPerformanceCounters
142 { 142 {
143 get { return _enableLocalPerformanceCounters; } 143 get { return _enableLocalPerformanceCounters; }
144 set 144 set
145 { 145 {
146 ThrowIfReadOnly(); 146 ThrowIfReadOnly();
147 _enableLocalPerformanceCounters = value; 147 _enableLocalPerformanceCounters = value;
148 } 148 }
149 } 149 }
150 150
151 /// <summary> 151 /// <summary>
152 /// Get/Set backgroundness of thread in thread pool. 152 /// Get/Set backgroundness of thread in thread pool.
153 /// </summary> 153 /// </summary>
154 public virtual bool AreThreadsBackground 154 public virtual bool AreThreadsBackground
155 { 155 {
156 get { return _areThreadsBackground; } 156 get { return _areThreadsBackground; }
157 set 157 set
158 { 158 {
159 ThrowIfReadOnly (); 159 ThrowIfReadOnly ();
160 _areThreadsBackground = value; 160 _areThreadsBackground = value;
161 } 161 }
162 } 162 }
163 163
164 /// <summary> 164 /// <summary>
165 /// Get a readonly version of this STPStartInfo. 165 /// Get a readonly version of this STPStartInfo.
166 /// </summary> 166 /// </summary>
167 /// <returns>Returns a readonly reference to this STPStartInfo</returns> 167 /// <returns>Returns a readonly reference to this STPStartInfo</returns>
168 public new STPStartInfo AsReadOnly() 168 public new STPStartInfo AsReadOnly()
169 { 169 {
170 return new STPStartInfo(this) { _readOnly = true }; 170 return new STPStartInfo(this) { _readOnly = true };
171 } 171 }
172 172
173#if !(_SILVERLIGHT) && !(WINDOWS_PHONE) 173#if !(_SILVERLIGHT) && !(WINDOWS_PHONE)
174 174
175 private ApartmentState _apartmentState = SmartThreadPool.DefaultApartmentState; 175 private ApartmentState _apartmentState = SmartThreadPool.DefaultApartmentState;
176 176
177 /// <summary> 177 /// <summary>
178 /// Get/Set the apartment state of threads in the thread pool 178 /// Get/Set the apartment state of threads in the thread pool
179 /// </summary> 179 /// </summary>
180 public ApartmentState ApartmentState 180 public ApartmentState ApartmentState
181 { 181 {
182 get { return _apartmentState; } 182 get { return _apartmentState; }
183 set 183 set
184 { 184 {
185 ThrowIfReadOnly(); 185 ThrowIfReadOnly();
186 _apartmentState = value; 186 _apartmentState = value;
187 } 187 }
188 } 188 }
189 189
190#if !(_SILVERLIGHT) && !(WINDOWS_PHONE) 190#if !(_SILVERLIGHT) && !(WINDOWS_PHONE)
191 191
192 /// <summary> 192 /// <summary>
193 /// Get/Set the max stack size of threads in the thread pool 193 /// Get/Set the max stack size of threads in the thread pool
194 /// </summary> 194 /// </summary>
195 public int? MaxStackSize 195 public int? MaxStackSize
196 { 196 {
197 get { return _maxStackSize; } 197 get { return _maxStackSize; }
198 set 198 set
199 { 199 {
200 ThrowIfReadOnly(); 200 ThrowIfReadOnly();
201 if (value.HasValue && value.Value < 0) 201 if (value.HasValue && value.Value < 0)
202 { 202 {
203 throw new ArgumentOutOfRangeException("value", "Value must be greater than 0."); 203 throw new ArgumentOutOfRangeException("value", "Value must be greater than 0.");
204 } 204 }
205 _maxStackSize = value; 205 _maxStackSize = value;
206 } 206 }
207 } 207 }
208#endif 208#endif
209 209
210#endif 210#endif
211 } 211 }
212} 212}