diff options
author | Justin Clark-Casey (justincc) | 2013-05-01 23:00:46 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-05-01 23:00:46 +0100 |
commit | 854dcd1abddc3eef33da953592deb61133e5e7ed (patch) | |
tree | d89d9d616384fdb4e6b4eec658339eac2f079ff2 /ThirdParty/SmartThreadPool/WorkItem.WorkItemResult.cs | |
parent | Add in-code exaplanation for the change in cancellation signalling in STP 2.2... (diff) | |
download | opensim-SC_OLD-854dcd1abddc3eef33da953592deb61133e5e7ed.zip opensim-SC_OLD-854dcd1abddc3eef33da953592deb61133e5e7ed.tar.gz opensim-SC_OLD-854dcd1abddc3eef33da953592deb61133e5e7ed.tar.bz2 opensim-SC_OLD-854dcd1abddc3eef33da953592deb61133e5e7ed.tar.xz |
Fix SmartThreadPool line endings in recent update from dos to unix
Diffstat (limited to '')
-rw-r--r-- | ThirdParty/SmartThreadPool/WorkItem.WorkItemResult.cs | 380 |
1 files changed, 190 insertions, 190 deletions
diff --git a/ThirdParty/SmartThreadPool/WorkItem.WorkItemResult.cs b/ThirdParty/SmartThreadPool/WorkItem.WorkItemResult.cs index 5745c15..435a14b 100644 --- a/ThirdParty/SmartThreadPool/WorkItem.WorkItemResult.cs +++ b/ThirdParty/SmartThreadPool/WorkItem.WorkItemResult.cs | |||
@@ -1,190 +1,190 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using System.Threading; | 4 | using System.Threading; |
5 | 5 | ||
6 | namespace Amib.Threading.Internal | 6 | namespace Amib.Threading.Internal |
7 | { | 7 | { |
8 | public partial class WorkItem | 8 | public partial class WorkItem |
9 | { | 9 | { |
10 | #region WorkItemResult class | 10 | #region WorkItemResult class |
11 | 11 | ||
12 | private class WorkItemResult : IWorkItemResult, IInternalWorkItemResult, IInternalWaitableResult | 12 | private class WorkItemResult : IWorkItemResult, IInternalWorkItemResult, IInternalWaitableResult |
13 | { | 13 | { |
14 | /// <summary> | 14 | /// <summary> |
15 | /// A back reference to the work item | 15 | /// A back reference to the work item |
16 | /// </summary> | 16 | /// </summary> |
17 | private readonly WorkItem _workItem; | 17 | private readonly WorkItem _workItem; |
18 | 18 | ||
19 | public WorkItemResult(WorkItem workItem) | 19 | public WorkItemResult(WorkItem workItem) |
20 | { | 20 | { |
21 | _workItem = workItem; | 21 | _workItem = workItem; |
22 | } | 22 | } |
23 | 23 | ||
24 | internal WorkItem GetWorkItem() | 24 | internal WorkItem GetWorkItem() |
25 | { | 25 | { |
26 | return _workItem; | 26 | return _workItem; |
27 | } | 27 | } |
28 | 28 | ||
29 | #region IWorkItemResult Members | 29 | #region IWorkItemResult Members |
30 | 30 | ||
31 | public bool IsCompleted | 31 | public bool IsCompleted |
32 | { | 32 | { |
33 | get | 33 | get |
34 | { | 34 | { |
35 | return _workItem.IsCompleted; | 35 | return _workItem.IsCompleted; |
36 | } | 36 | } |
37 | } | 37 | } |
38 | 38 | ||
39 | public bool IsCanceled | 39 | public bool IsCanceled |
40 | { | 40 | { |
41 | get | 41 | get |
42 | { | 42 | { |
43 | return _workItem.IsCanceled; | 43 | return _workItem.IsCanceled; |
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
47 | public object GetResult() | 47 | public object GetResult() |
48 | { | 48 | { |
49 | return _workItem.GetResult(Timeout.Infinite, true, null); | 49 | return _workItem.GetResult(Timeout.Infinite, true, null); |
50 | } | 50 | } |
51 | 51 | ||
52 | public object GetResult(int millisecondsTimeout, bool exitContext) | 52 | public object GetResult(int millisecondsTimeout, bool exitContext) |
53 | { | 53 | { |
54 | return _workItem.GetResult(millisecondsTimeout, exitContext, null); | 54 | return _workItem.GetResult(millisecondsTimeout, exitContext, null); |
55 | } | 55 | } |
56 | 56 | ||
57 | public object GetResult(TimeSpan timeout, bool exitContext) | 57 | public object GetResult(TimeSpan timeout, bool exitContext) |
58 | { | 58 | { |
59 | return _workItem.GetResult((int)timeout.TotalMilliseconds, exitContext, null); | 59 | return _workItem.GetResult((int)timeout.TotalMilliseconds, exitContext, null); |
60 | } | 60 | } |
61 | 61 | ||
62 | public object GetResult(int millisecondsTimeout, bool exitContext, WaitHandle cancelWaitHandle) | 62 | public object GetResult(int millisecondsTimeout, bool exitContext, WaitHandle cancelWaitHandle) |
63 | { | 63 | { |
64 | return _workItem.GetResult(millisecondsTimeout, exitContext, cancelWaitHandle); | 64 | return _workItem.GetResult(millisecondsTimeout, exitContext, cancelWaitHandle); |
65 | } | 65 | } |
66 | 66 | ||
67 | public object GetResult(TimeSpan timeout, bool exitContext, WaitHandle cancelWaitHandle) | 67 | public object GetResult(TimeSpan timeout, bool exitContext, WaitHandle cancelWaitHandle) |
68 | { | 68 | { |
69 | return _workItem.GetResult((int)timeout.TotalMilliseconds, exitContext, cancelWaitHandle); | 69 | return _workItem.GetResult((int)timeout.TotalMilliseconds, exitContext, cancelWaitHandle); |
70 | } | 70 | } |
71 | 71 | ||
72 | public object GetResult(out Exception e) | 72 | public object GetResult(out Exception e) |
73 | { | 73 | { |
74 | return _workItem.GetResult(Timeout.Infinite, true, null, out e); | 74 | return _workItem.GetResult(Timeout.Infinite, true, null, out e); |
75 | } | 75 | } |
76 | 76 | ||
77 | public object GetResult(int millisecondsTimeout, bool exitContext, out Exception e) | 77 | public object GetResult(int millisecondsTimeout, bool exitContext, out Exception e) |
78 | { | 78 | { |
79 | return _workItem.GetResult(millisecondsTimeout, exitContext, null, out e); | 79 | return _workItem.GetResult(millisecondsTimeout, exitContext, null, out e); |
80 | } | 80 | } |
81 | 81 | ||
82 | public object GetResult(TimeSpan timeout, bool exitContext, out Exception e) | 82 | public object GetResult(TimeSpan timeout, bool exitContext, out Exception e) |
83 | { | 83 | { |
84 | return _workItem.GetResult((int)timeout.TotalMilliseconds, exitContext, null, out e); | 84 | return _workItem.GetResult((int)timeout.TotalMilliseconds, exitContext, null, out e); |
85 | } | 85 | } |
86 | 86 | ||
87 | public object GetResult(int millisecondsTimeout, bool exitContext, WaitHandle cancelWaitHandle, out Exception e) | 87 | public object GetResult(int millisecondsTimeout, bool exitContext, WaitHandle cancelWaitHandle, out Exception e) |
88 | { | 88 | { |
89 | return _workItem.GetResult(millisecondsTimeout, exitContext, cancelWaitHandle, out e); | 89 | return _workItem.GetResult(millisecondsTimeout, exitContext, cancelWaitHandle, out e); |
90 | } | 90 | } |
91 | 91 | ||
92 | public object GetResult(TimeSpan timeout, bool exitContext, WaitHandle cancelWaitHandle, out Exception e) | 92 | public object GetResult(TimeSpan timeout, bool exitContext, WaitHandle cancelWaitHandle, out Exception e) |
93 | { | 93 | { |
94 | return _workItem.GetResult((int)timeout.TotalMilliseconds, exitContext, cancelWaitHandle, out e); | 94 | return _workItem.GetResult((int)timeout.TotalMilliseconds, exitContext, cancelWaitHandle, out e); |
95 | } | 95 | } |
96 | 96 | ||
97 | public bool Cancel() | 97 | public bool Cancel() |
98 | { | 98 | { |
99 | return Cancel(false); | 99 | return Cancel(false); |
100 | } | 100 | } |
101 | 101 | ||
102 | public bool Cancel(bool abortExecution) | 102 | public bool Cancel(bool abortExecution) |
103 | { | 103 | { |
104 | return _workItem.Cancel(abortExecution); | 104 | return _workItem.Cancel(abortExecution); |
105 | } | 105 | } |
106 | 106 | ||
107 | public object State | 107 | public object State |
108 | { | 108 | { |
109 | get | 109 | get |
110 | { | 110 | { |
111 | return _workItem._state; | 111 | return _workItem._state; |
112 | } | 112 | } |
113 | } | 113 | } |
114 | 114 | ||
115 | public WorkItemPriority WorkItemPriority | 115 | public WorkItemPriority WorkItemPriority |
116 | { | 116 | { |
117 | get | 117 | get |
118 | { | 118 | { |
119 | return _workItem._workItemInfo.WorkItemPriority; | 119 | return _workItem._workItemInfo.WorkItemPriority; |
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | /// <summary> | 123 | /// <summary> |
124 | /// Return the result, same as GetResult() | 124 | /// Return the result, same as GetResult() |
125 | /// </summary> | 125 | /// </summary> |
126 | public object Result | 126 | public object Result |
127 | { | 127 | { |
128 | get { return GetResult(); } | 128 | get { return GetResult(); } |
129 | } | 129 | } |
130 | 130 | ||
131 | /// <summary> | 131 | /// <summary> |
132 | /// Returns the exception if occured otherwise returns null. | 132 | /// Returns the exception if occured otherwise returns null. |
133 | /// This value is valid only after the work item completed, | 133 | /// This value is valid only after the work item completed, |
134 | /// before that it is always null. | 134 | /// before that it is always null. |
135 | /// </summary> | 135 | /// </summary> |
136 | public object Exception | 136 | public object Exception |
137 | { | 137 | { |
138 | get { return _workItem._exception; } | 138 | get { return _workItem._exception; } |
139 | } | 139 | } |
140 | 140 | ||
141 | #endregion | 141 | #endregion |
142 | 142 | ||
143 | #region IInternalWorkItemResult Members | 143 | #region IInternalWorkItemResult Members |
144 | 144 | ||
145 | public event WorkItemStateCallback OnWorkItemStarted | 145 | public event WorkItemStateCallback OnWorkItemStarted |
146 | { | 146 | { |
147 | add | 147 | add |
148 | { | 148 | { |
149 | _workItem.OnWorkItemStarted += value; | 149 | _workItem.OnWorkItemStarted += value; |
150 | } | 150 | } |
151 | remove | 151 | remove |
152 | { | 152 | { |
153 | _workItem.OnWorkItemStarted -= value; | 153 | _workItem.OnWorkItemStarted -= value; |
154 | } | 154 | } |
155 | } | 155 | } |
156 | 156 | ||
157 | 157 | ||
158 | public event WorkItemStateCallback OnWorkItemCompleted | 158 | public event WorkItemStateCallback OnWorkItemCompleted |
159 | { | 159 | { |
160 | add | 160 | add |
161 | { | 161 | { |
162 | _workItem.OnWorkItemCompleted += value; | 162 | _workItem.OnWorkItemCompleted += value; |
163 | } | 163 | } |
164 | remove | 164 | remove |
165 | { | 165 | { |
166 | _workItem.OnWorkItemCompleted -= value; | 166 | _workItem.OnWorkItemCompleted -= value; |
167 | } | 167 | } |
168 | } | 168 | } |
169 | 169 | ||
170 | #endregion | 170 | #endregion |
171 | 171 | ||
172 | #region IInternalWorkItemResult Members | 172 | #region IInternalWorkItemResult Members |
173 | 173 | ||
174 | public IWorkItemResult GetWorkItemResult() | 174 | public IWorkItemResult GetWorkItemResult() |
175 | { | 175 | { |
176 | return this; | 176 | return this; |
177 | } | 177 | } |
178 | 178 | ||
179 | public IWorkItemResult<TResult> GetWorkItemResultT<TResult>() | 179 | public IWorkItemResult<TResult> GetWorkItemResultT<TResult>() |
180 | { | 180 | { |
181 | return new WorkItemResultTWrapper<TResult>(this); | 181 | return new WorkItemResultTWrapper<TResult>(this); |
182 | } | 182 | } |
183 | 183 | ||
184 | #endregion | 184 | #endregion |
185 | } | 185 | } |
186 | 186 | ||
187 | #endregion | 187 | #endregion |
188 | 188 | ||
189 | } | 189 | } |
190 | } | 190 | } |