aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ThirdParty/SmartThreadPool/WIGStartInfo.cs
diff options
context:
space:
mode:
authorDiva Canto2013-05-06 09:18:17 -0700
committerDiva Canto2013-05-06 09:18:17 -0700
commita81ddf3d7097a2e0959080ae7291357435b0bd5b (patch)
tree688ceb63aa41d8eb9d3af27bd57d39cbd38ca250 /ThirdParty/SmartThreadPool/WIGStartInfo.cs
parentMinor reordering of operations on NewUserConnection. The agent circuit needs ... (diff)
parentMerge branch 'master' into bulletsim4 (diff)
downloadopensim-SC_OLD-a81ddf3d7097a2e0959080ae7291357435b0bd5b.zip
opensim-SC_OLD-a81ddf3d7097a2e0959080ae7291357435b0bd5b.tar.gz
opensim-SC_OLD-a81ddf3d7097a2e0959080ae7291357435b0bd5b.tar.bz2
opensim-SC_OLD-a81ddf3d7097a2e0959080ae7291357435b0bd5b.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'ThirdParty/SmartThreadPool/WIGStartInfo.cs')
-rw-r--r--ThirdParty/SmartThreadPool/WIGStartInfo.cs218
1 files changed, 145 insertions, 73 deletions
diff --git a/ThirdParty/SmartThreadPool/WIGStartInfo.cs b/ThirdParty/SmartThreadPool/WIGStartInfo.cs
index 150317f..8af195b 100644
--- a/ThirdParty/SmartThreadPool/WIGStartInfo.cs
+++ b/ThirdParty/SmartThreadPool/WIGStartInfo.cs
@@ -1,99 +1,171 @@
1// Ami Bar 1using System;
2// amibar@gmail.com
3 2
4namespace Amib.Threading 3namespace Amib.Threading
5{ 4{
6 /// <summary> 5 /// <summary>
7 /// Summary description for WIGStartInfo. 6 /// Summary description for WIGStartInfo.
8 /// </summary> 7 /// </summary>
9 public class WIGStartInfo 8 public class WIGStartInfo
10 { 9 {
11 /// <summary>
12 /// Use the caller's security context
13 /// </summary>
14 private bool _useCallerCallContext; 10 private bool _useCallerCallContext;
15
16 /// <summary>
17 /// Use the caller's HTTP context
18 /// </summary>
19 private bool _useCallerHttpContext; 11 private bool _useCallerHttpContext;
20
21 /// <summary>
22 /// Dispose of the state object of a work item
23 /// </summary>
24 private bool _disposeOfStateObjects; 12 private bool _disposeOfStateObjects;
25
26 /// <summary>
27 /// The option to run the post execute
28 /// </summary>
29 private CallToPostExecute _callToPostExecute; 13 private CallToPostExecute _callToPostExecute;
30
31 /// <summary>
32 /// A post execute callback to call when none is provided in
33 /// the QueueWorkItem method.
34 /// </summary>
35 private PostExecuteWorkItemCallback _postExecuteWorkItemCallback; 14 private PostExecuteWorkItemCallback _postExecuteWorkItemCallback;
36
37 /// <summary>
38 /// Indicate the WorkItemsGroup to suspend the handling of the work items
39 /// until the Start() method is called.
40 /// </summary>
41 private bool _startSuspended; 15 private bool _startSuspended;
16 private WorkItemPriority _workItemPriority;
17 private bool _fillStateWithArgs;
42 18
43 public WIGStartInfo() 19 protected bool _readOnly;
20
21 public WIGStartInfo()
44 { 22 {
45 _useCallerCallContext = SmartThreadPool.DefaultUseCallerCallContext; 23 _fillStateWithArgs = SmartThreadPool.DefaultFillStateWithArgs;
46 _useCallerHttpContext = SmartThreadPool.DefaultUseCallerHttpContext; 24 _workItemPriority = SmartThreadPool.DefaultWorkItemPriority;
47 _disposeOfStateObjects = SmartThreadPool.DefaultDisposeOfStateObjects;
48 _callToPostExecute = SmartThreadPool.DefaultCallToPostExecute;
49 _postExecuteWorkItemCallback = SmartThreadPool.DefaultPostExecuteWorkItemCallback;
50 _startSuspended = SmartThreadPool.DefaultStartSuspended; 25 _startSuspended = SmartThreadPool.DefaultStartSuspended;
26 _postExecuteWorkItemCallback = SmartThreadPool.DefaultPostExecuteWorkItemCallback;
27 _callToPostExecute = SmartThreadPool.DefaultCallToPostExecute;
28 _disposeOfStateObjects = SmartThreadPool.DefaultDisposeOfStateObjects;
29 _useCallerHttpContext = SmartThreadPool.DefaultUseCallerHttpContext;
30 _useCallerCallContext = SmartThreadPool.DefaultUseCallerCallContext;
51 } 31 }
52 32
53 public WIGStartInfo(WIGStartInfo wigStartInfo) 33 public WIGStartInfo(WIGStartInfo wigStartInfo)
54 { 34 {
55 _useCallerCallContext = wigStartInfo._useCallerCallContext; 35 _useCallerCallContext = wigStartInfo.UseCallerCallContext;
56 _useCallerHttpContext = wigStartInfo._useCallerHttpContext; 36 _useCallerHttpContext = wigStartInfo.UseCallerHttpContext;
57 _disposeOfStateObjects = wigStartInfo._disposeOfStateObjects; 37 _disposeOfStateObjects = wigStartInfo.DisposeOfStateObjects;
58 _callToPostExecute = wigStartInfo._callToPostExecute; 38 _callToPostExecute = wigStartInfo.CallToPostExecute;
59 _postExecuteWorkItemCallback = wigStartInfo._postExecuteWorkItemCallback; 39 _postExecuteWorkItemCallback = wigStartInfo.PostExecuteWorkItemCallback;
60 _startSuspended = wigStartInfo._startSuspended; 40 _workItemPriority = wigStartInfo.WorkItemPriority;
41 _startSuspended = wigStartInfo.StartSuspended;
42 _fillStateWithArgs = wigStartInfo.FillStateWithArgs;
61 } 43 }
62 44
63 public bool UseCallerCallContext 45 protected void ThrowIfReadOnly()
64 { 46 {
65 get { return _useCallerCallContext; } 47 if (_readOnly)
66 set { _useCallerCallContext = value; } 48 {
49 throw new NotSupportedException("This is a readonly instance and set is not supported");
50 }
67 } 51 }
68 52
69 public bool UseCallerHttpContext 53 /// <summary>
70 { 54 /// Get/Set if to use the caller's security context
71 get { return _useCallerHttpContext; } 55 /// </summary>
72 set { _useCallerHttpContext = value; } 56 public virtual bool UseCallerCallContext
73 } 57 {
58 get { return _useCallerCallContext; }
59 set
60 {
61 ThrowIfReadOnly();
62 _useCallerCallContext = value;
63 }
64 }
74 65
75 public bool DisposeOfStateObjects
76 {
77 get { return _disposeOfStateObjects; }
78 set { _disposeOfStateObjects = value; }
79 }
80 66
81 public CallToPostExecute CallToPostExecute 67 /// <summary>
82 { 68 /// Get/Set if to use the caller's HTTP context
83 get { return _callToPostExecute; } 69 /// </summary>
84 set { _callToPostExecute = value; } 70 public virtual bool UseCallerHttpContext
85 } 71 {
72 get { return _useCallerHttpContext; }
73 set
74 {
75 ThrowIfReadOnly();
76 _useCallerHttpContext = value;
77 }
78 }
86 79
87 public PostExecuteWorkItemCallback PostExecuteWorkItemCallback
88 {
89 get { return _postExecuteWorkItemCallback; }
90 set { _postExecuteWorkItemCallback = value; }
91 }
92 80
93 public bool StartSuspended 81 /// <summary>
94 { 82 /// Get/Set if to dispose of the state object of a work item
95 get { return _startSuspended; } 83 /// </summary>
96 set { _startSuspended = value; } 84 public virtual bool DisposeOfStateObjects
97 } 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&lt;...&gt;/Func&lt;...&gt; 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 }
98 } 170 }
99} 171}