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