diff options
Diffstat (limited to '')
-rw-r--r-- | ThirdParty/SmartThreadPool/WIGStartInfo.cs | 342 |
1 files changed, 171 insertions, 171 deletions
diff --git a/ThirdParty/SmartThreadPool/WIGStartInfo.cs b/ThirdParty/SmartThreadPool/WIGStartInfo.cs index e5ff150..8af195b 100644 --- a/ThirdParty/SmartThreadPool/WIGStartInfo.cs +++ b/ThirdParty/SmartThreadPool/WIGStartInfo.cs | |||
@@ -1,171 +1,171 @@ | |||
1 | using System; | 1 | using System; |
2 | 2 | ||
3 | namespace Amib.Threading | 3 | namespace Amib.Threading |
4 | { | 4 | { |
5 | /// <summary> | 5 | /// <summary> |
6 | /// Summary description for WIGStartInfo. | 6 | /// Summary description for WIGStartInfo. |
7 | /// </summary> | 7 | /// </summary> |
8 | public class WIGStartInfo | 8 | public class WIGStartInfo |
9 | { | 9 | { |
10 | private bool _useCallerCallContext; | 10 | private bool _useCallerCallContext; |
11 | private bool _useCallerHttpContext; | 11 | private bool _useCallerHttpContext; |
12 | private bool _disposeOfStateObjects; | 12 | private bool _disposeOfStateObjects; |
13 | private CallToPostExecute _callToPostExecute; | 13 | private CallToPostExecute _callToPostExecute; |
14 | private PostExecuteWorkItemCallback _postExecuteWorkItemCallback; | 14 | private PostExecuteWorkItemCallback _postExecuteWorkItemCallback; |
15 | private bool _startSuspended; | 15 | private bool _startSuspended; |
16 | private WorkItemPriority _workItemPriority; | 16 | private WorkItemPriority _workItemPriority; |
17 | private bool _fillStateWithArgs; | 17 | private bool _fillStateWithArgs; |
18 | 18 | ||
19 | protected bool _readOnly; | 19 | protected bool _readOnly; |
20 | 20 | ||
21 | public WIGStartInfo() | 21 | public WIGStartInfo() |
22 | { | 22 | { |
23 | _fillStateWithArgs = SmartThreadPool.DefaultFillStateWithArgs; | 23 | _fillStateWithArgs = SmartThreadPool.DefaultFillStateWithArgs; |
24 | _workItemPriority = SmartThreadPool.DefaultWorkItemPriority; | 24 | _workItemPriority = SmartThreadPool.DefaultWorkItemPriority; |
25 | _startSuspended = SmartThreadPool.DefaultStartSuspended; | 25 | _startSuspended = SmartThreadPool.DefaultStartSuspended; |
26 | _postExecuteWorkItemCallback = SmartThreadPool.DefaultPostExecuteWorkItemCallback; | 26 | _postExecuteWorkItemCallback = SmartThreadPool.DefaultPostExecuteWorkItemCallback; |
27 | _callToPostExecute = SmartThreadPool.DefaultCallToPostExecute; | 27 | _callToPostExecute = SmartThreadPool.DefaultCallToPostExecute; |
28 | _disposeOfStateObjects = SmartThreadPool.DefaultDisposeOfStateObjects; | 28 | _disposeOfStateObjects = SmartThreadPool.DefaultDisposeOfStateObjects; |
29 | _useCallerHttpContext = SmartThreadPool.DefaultUseCallerHttpContext; | 29 | _useCallerHttpContext = SmartThreadPool.DefaultUseCallerHttpContext; |
30 | _useCallerCallContext = SmartThreadPool.DefaultUseCallerCallContext; | 30 | _useCallerCallContext = SmartThreadPool.DefaultUseCallerCallContext; |
31 | } | 31 | } |
32 | 32 | ||
33 | public WIGStartInfo(WIGStartInfo wigStartInfo) | 33 | public WIGStartInfo(WIGStartInfo wigStartInfo) |
34 | { | 34 | { |
35 | _useCallerCallContext = wigStartInfo.UseCallerCallContext; | 35 | _useCallerCallContext = wigStartInfo.UseCallerCallContext; |
36 | _useCallerHttpContext = wigStartInfo.UseCallerHttpContext; | 36 | _useCallerHttpContext = wigStartInfo.UseCallerHttpContext; |
37 | _disposeOfStateObjects = wigStartInfo.DisposeOfStateObjects; | 37 | _disposeOfStateObjects = wigStartInfo.DisposeOfStateObjects; |
38 | _callToPostExecute = wigStartInfo.CallToPostExecute; | 38 | _callToPostExecute = wigStartInfo.CallToPostExecute; |
39 | _postExecuteWorkItemCallback = wigStartInfo.PostExecuteWorkItemCallback; | 39 | _postExecuteWorkItemCallback = wigStartInfo.PostExecuteWorkItemCallback; |
40 | _workItemPriority = wigStartInfo.WorkItemPriority; | 40 | _workItemPriority = wigStartInfo.WorkItemPriority; |
41 | _startSuspended = wigStartInfo.StartSuspended; | 41 | _startSuspended = wigStartInfo.StartSuspended; |
42 | _fillStateWithArgs = wigStartInfo.FillStateWithArgs; | 42 | _fillStateWithArgs = wigStartInfo.FillStateWithArgs; |
43 | } | 43 | } |
44 | 44 | ||
45 | protected void ThrowIfReadOnly() | 45 | protected void ThrowIfReadOnly() |
46 | { | 46 | { |
47 | if (_readOnly) | 47 | if (_readOnly) |
48 | { | 48 | { |
49 | throw new NotSupportedException("This is a readonly instance and set is not supported"); | 49 | throw new NotSupportedException("This is a readonly instance and set is not supported"); |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | /// <summary> | 53 | /// <summary> |
54 | /// Get/Set if to use the caller's security context | 54 | /// Get/Set if to use the caller's security context |
55 | /// </summary> | 55 | /// </summary> |
56 | public virtual bool UseCallerCallContext | 56 | public virtual bool UseCallerCallContext |
57 | { | 57 | { |
58 | get { return _useCallerCallContext; } | 58 | get { return _useCallerCallContext; } |
59 | set | 59 | set |
60 | { | 60 | { |
61 | ThrowIfReadOnly(); | 61 | ThrowIfReadOnly(); |
62 | _useCallerCallContext = value; | 62 | _useCallerCallContext = value; |
63 | } | 63 | } |
64 | } | 64 | } |
65 | 65 | ||
66 | 66 | ||
67 | /// <summary> | 67 | /// <summary> |
68 | /// Get/Set if to use the caller's HTTP context | 68 | /// Get/Set if to use the caller's HTTP context |
69 | /// </summary> | 69 | /// </summary> |
70 | public virtual bool UseCallerHttpContext | 70 | public virtual bool UseCallerHttpContext |
71 | { | 71 | { |
72 | get { return _useCallerHttpContext; } | 72 | get { return _useCallerHttpContext; } |
73 | set | 73 | set |
74 | { | 74 | { |
75 | ThrowIfReadOnly(); | 75 | ThrowIfReadOnly(); |
76 | _useCallerHttpContext = value; | 76 | _useCallerHttpContext = value; |
77 | } | 77 | } |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | /// <summary> | 81 | /// <summary> |
82 | /// Get/Set if to dispose of the state object of a work item | 82 | /// Get/Set if to dispose of the state object of a work item |
83 | /// </summary> | 83 | /// </summary> |
84 | public virtual bool DisposeOfStateObjects | 84 | public virtual bool DisposeOfStateObjects |
85 | { | 85 | { |
86 | get { return _disposeOfStateObjects; } | 86 | get { return _disposeOfStateObjects; } |
87 | set | 87 | set |
88 | { | 88 | { |
89 | ThrowIfReadOnly(); | 89 | ThrowIfReadOnly(); |
90 | _disposeOfStateObjects = value; | 90 | _disposeOfStateObjects = value; |
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
94 | 94 | ||
95 | /// <summary> | 95 | /// <summary> |
96 | /// Get/Set the run the post execute options | 96 | /// Get/Set the run the post execute options |
97 | /// </summary> | 97 | /// </summary> |
98 | public virtual CallToPostExecute CallToPostExecute | 98 | public virtual CallToPostExecute CallToPostExecute |
99 | { | 99 | { |
100 | get { return _callToPostExecute; } | 100 | get { return _callToPostExecute; } |
101 | set | 101 | set |
102 | { | 102 | { |
103 | ThrowIfReadOnly(); | 103 | ThrowIfReadOnly(); |
104 | _callToPostExecute = value; | 104 | _callToPostExecute = value; |
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | /// <summary> | 109 | /// <summary> |
110 | /// Get/Set the default post execute callback | 110 | /// Get/Set the default post execute callback |
111 | /// </summary> | 111 | /// </summary> |
112 | public virtual PostExecuteWorkItemCallback PostExecuteWorkItemCallback | 112 | public virtual PostExecuteWorkItemCallback PostExecuteWorkItemCallback |
113 | { | 113 | { |
114 | get { return _postExecuteWorkItemCallback; } | 114 | get { return _postExecuteWorkItemCallback; } |
115 | set | 115 | set |
116 | { | 116 | { |
117 | ThrowIfReadOnly(); | 117 | ThrowIfReadOnly(); |
118 | _postExecuteWorkItemCallback = value; | 118 | _postExecuteWorkItemCallback = value; |
119 | } | 119 | } |
120 | } | 120 | } |
121 | 121 | ||
122 | 122 | ||
123 | /// <summary> | 123 | /// <summary> |
124 | /// Get/Set if the work items execution should be suspended until the Start() | 124 | /// Get/Set if the work items execution should be suspended until the Start() |
125 | /// method is called. | 125 | /// method is called. |
126 | /// </summary> | 126 | /// </summary> |
127 | public virtual bool StartSuspended | 127 | public virtual bool StartSuspended |
128 | { | 128 | { |
129 | get { return _startSuspended; } | 129 | get { return _startSuspended; } |
130 | set | 130 | set |
131 | { | 131 | { |
132 | ThrowIfReadOnly(); | 132 | ThrowIfReadOnly(); |
133 | _startSuspended = value; | 133 | _startSuspended = value; |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | 137 | ||
138 | /// <summary> | 138 | /// <summary> |
139 | /// Get/Set the default priority that a work item gets when it is enqueued | 139 | /// Get/Set the default priority that a work item gets when it is enqueued |
140 | /// </summary> | 140 | /// </summary> |
141 | public virtual WorkItemPriority WorkItemPriority | 141 | public virtual WorkItemPriority WorkItemPriority |
142 | { | 142 | { |
143 | get { return _workItemPriority; } | 143 | get { return _workItemPriority; } |
144 | set { _workItemPriority = value; } | 144 | set { _workItemPriority = value; } |
145 | } | 145 | } |
146 | 146 | ||
147 | /// <summary> | 147 | /// <summary> |
148 | /// Get/Set the if QueueWorkItem of Action<...>/Func<...> fill the | 148 | /// Get/Set the if QueueWorkItem of Action<...>/Func<...> fill the |
149 | /// arguments as an object array into the state of the work item. | 149 | /// arguments as an object array into the state of the work item. |
150 | /// The arguments can be access later by IWorkItemResult.State. | 150 | /// The arguments can be access later by IWorkItemResult.State. |
151 | /// </summary> | 151 | /// </summary> |
152 | public virtual bool FillStateWithArgs | 152 | public virtual bool FillStateWithArgs |
153 | { | 153 | { |
154 | get { return _fillStateWithArgs; } | 154 | get { return _fillStateWithArgs; } |
155 | set | 155 | set |
156 | { | 156 | { |
157 | ThrowIfReadOnly(); | 157 | ThrowIfReadOnly(); |
158 | _fillStateWithArgs = value; | 158 | _fillStateWithArgs = value; |
159 | } | 159 | } |
160 | } | 160 | } |
161 | 161 | ||
162 | /// <summary> | 162 | /// <summary> |
163 | /// Get a readonly version of this WIGStartInfo | 163 | /// Get a readonly version of this WIGStartInfo |
164 | /// </summary> | 164 | /// </summary> |
165 | /// <returns>Returns a readonly reference to this WIGStartInfoRO</returns> | 165 | /// <returns>Returns a readonly reference to this WIGStartInfoRO</returns> |
166 | public WIGStartInfo AsReadOnly() | 166 | public WIGStartInfo AsReadOnly() |
167 | { | 167 | { |
168 | return new WIGStartInfo(this) { _readOnly = true }; | 168 | return new WIGStartInfo(this) { _readOnly = true }; |
169 | } | 169 | } |
170 | } | 170 | } |
171 | } | 171 | } |