diff options
Diffstat (limited to '')
-rw-r--r-- | ThirdParty/SmartThreadPool/WorkItemResultTWrapper.cs | 256 |
1 files changed, 128 insertions, 128 deletions
diff --git a/ThirdParty/SmartThreadPool/WorkItemResultTWrapper.cs b/ThirdParty/SmartThreadPool/WorkItemResultTWrapper.cs index a0bf8b8..d1eff95 100644 --- a/ThirdParty/SmartThreadPool/WorkItemResultTWrapper.cs +++ b/ThirdParty/SmartThreadPool/WorkItemResultTWrapper.cs | |||
@@ -1,128 +1,128 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Threading; | 2 | using System.Threading; |
3 | 3 | ||
4 | namespace Amib.Threading.Internal | 4 | namespace Amib.Threading.Internal |
5 | { | 5 | { |
6 | #region WorkItemResultTWrapper class | 6 | #region WorkItemResultTWrapper class |
7 | 7 | ||
8 | internal class WorkItemResultTWrapper<TResult> : IWorkItemResult<TResult>, IInternalWaitableResult | 8 | internal class WorkItemResultTWrapper<TResult> : IWorkItemResult<TResult>, IInternalWaitableResult |
9 | { | 9 | { |
10 | private readonly IWorkItemResult _workItemResult; | 10 | private readonly IWorkItemResult _workItemResult; |
11 | 11 | ||
12 | public WorkItemResultTWrapper(IWorkItemResult workItemResult) | 12 | public WorkItemResultTWrapper(IWorkItemResult workItemResult) |
13 | { | 13 | { |
14 | _workItemResult = workItemResult; | 14 | _workItemResult = workItemResult; |
15 | } | 15 | } |
16 | 16 | ||
17 | #region IWorkItemResult<TResult> Members | 17 | #region IWorkItemResult<TResult> Members |
18 | 18 | ||
19 | public TResult GetResult() | 19 | public TResult GetResult() |
20 | { | 20 | { |
21 | return (TResult)_workItemResult.GetResult(); | 21 | return (TResult)_workItemResult.GetResult(); |
22 | } | 22 | } |
23 | 23 | ||
24 | public TResult GetResult(int millisecondsTimeout, bool exitContext) | 24 | public TResult GetResult(int millisecondsTimeout, bool exitContext) |
25 | { | 25 | { |
26 | return (TResult)_workItemResult.GetResult(millisecondsTimeout, exitContext); | 26 | return (TResult)_workItemResult.GetResult(millisecondsTimeout, exitContext); |
27 | } | 27 | } |
28 | 28 | ||
29 | public TResult GetResult(TimeSpan timeout, bool exitContext) | 29 | public TResult GetResult(TimeSpan timeout, bool exitContext) |
30 | { | 30 | { |
31 | return (TResult)_workItemResult.GetResult(timeout, exitContext); | 31 | return (TResult)_workItemResult.GetResult(timeout, exitContext); |
32 | } | 32 | } |
33 | 33 | ||
34 | public TResult GetResult(int millisecondsTimeout, bool exitContext, WaitHandle cancelWaitHandle) | 34 | public TResult GetResult(int millisecondsTimeout, bool exitContext, WaitHandle cancelWaitHandle) |
35 | { | 35 | { |
36 | return (TResult)_workItemResult.GetResult(millisecondsTimeout, exitContext, cancelWaitHandle); | 36 | return (TResult)_workItemResult.GetResult(millisecondsTimeout, exitContext, cancelWaitHandle); |
37 | } | 37 | } |
38 | 38 | ||
39 | public TResult GetResult(TimeSpan timeout, bool exitContext, WaitHandle cancelWaitHandle) | 39 | public TResult GetResult(TimeSpan timeout, bool exitContext, WaitHandle cancelWaitHandle) |
40 | { | 40 | { |
41 | return (TResult)_workItemResult.GetResult(timeout, exitContext, cancelWaitHandle); | 41 | return (TResult)_workItemResult.GetResult(timeout, exitContext, cancelWaitHandle); |
42 | } | 42 | } |
43 | 43 | ||
44 | public TResult GetResult(out Exception e) | 44 | public TResult GetResult(out Exception e) |
45 | { | 45 | { |
46 | return (TResult)_workItemResult.GetResult(out e); | 46 | return (TResult)_workItemResult.GetResult(out e); |
47 | } | 47 | } |
48 | 48 | ||
49 | public TResult GetResult(int millisecondsTimeout, bool exitContext, out Exception e) | 49 | public TResult GetResult(int millisecondsTimeout, bool exitContext, out Exception e) |
50 | { | 50 | { |
51 | return (TResult)_workItemResult.GetResult(millisecondsTimeout, exitContext, out e); | 51 | return (TResult)_workItemResult.GetResult(millisecondsTimeout, exitContext, out e); |
52 | } | 52 | } |
53 | 53 | ||
54 | public TResult GetResult(TimeSpan timeout, bool exitContext, out Exception e) | 54 | public TResult GetResult(TimeSpan timeout, bool exitContext, out Exception e) |
55 | { | 55 | { |
56 | return (TResult)_workItemResult.GetResult(timeout, exitContext, out e); | 56 | return (TResult)_workItemResult.GetResult(timeout, exitContext, out e); |
57 | } | 57 | } |
58 | 58 | ||
59 | public TResult GetResult(int millisecondsTimeout, bool exitContext, WaitHandle cancelWaitHandle, out Exception e) | 59 | public TResult GetResult(int millisecondsTimeout, bool exitContext, WaitHandle cancelWaitHandle, out Exception e) |
60 | { | 60 | { |
61 | return (TResult)_workItemResult.GetResult(millisecondsTimeout, exitContext, cancelWaitHandle, out e); | 61 | return (TResult)_workItemResult.GetResult(millisecondsTimeout, exitContext, cancelWaitHandle, out e); |
62 | } | 62 | } |
63 | 63 | ||
64 | public TResult GetResult(TimeSpan timeout, bool exitContext, WaitHandle cancelWaitHandle, out Exception e) | 64 | public TResult GetResult(TimeSpan timeout, bool exitContext, WaitHandle cancelWaitHandle, out Exception e) |
65 | { | 65 | { |
66 | return (TResult)_workItemResult.GetResult(timeout, exitContext, cancelWaitHandle, out e); | 66 | return (TResult)_workItemResult.GetResult(timeout, exitContext, cancelWaitHandle, out e); |
67 | } | 67 | } |
68 | 68 | ||
69 | public bool IsCompleted | 69 | public bool IsCompleted |
70 | { | 70 | { |
71 | get { return _workItemResult.IsCompleted; } | 71 | get { return _workItemResult.IsCompleted; } |
72 | } | 72 | } |
73 | 73 | ||
74 | public bool IsCanceled | 74 | public bool IsCanceled |
75 | { | 75 | { |
76 | get { return _workItemResult.IsCanceled; } | 76 | get { return _workItemResult.IsCanceled; } |
77 | } | 77 | } |
78 | 78 | ||
79 | public object State | 79 | public object State |
80 | { | 80 | { |
81 | get { return _workItemResult.State; } | 81 | get { return _workItemResult.State; } |
82 | } | 82 | } |
83 | 83 | ||
84 | public bool Cancel() | 84 | public bool Cancel() |
85 | { | 85 | { |
86 | return _workItemResult.Cancel(); | 86 | return _workItemResult.Cancel(); |
87 | } | 87 | } |
88 | 88 | ||
89 | public bool Cancel(bool abortExecution) | 89 | public bool Cancel(bool abortExecution) |
90 | { | 90 | { |
91 | return _workItemResult.Cancel(abortExecution); | 91 | return _workItemResult.Cancel(abortExecution); |
92 | } | 92 | } |
93 | 93 | ||
94 | public WorkItemPriority WorkItemPriority | 94 | public WorkItemPriority WorkItemPriority |
95 | { | 95 | { |
96 | get { return _workItemResult.WorkItemPriority; } | 96 | get { return _workItemResult.WorkItemPriority; } |
97 | } | 97 | } |
98 | 98 | ||
99 | public TResult Result | 99 | public TResult Result |
100 | { | 100 | { |
101 | get { return (TResult)_workItemResult.Result; } | 101 | get { return (TResult)_workItemResult.Result; } |
102 | } | 102 | } |
103 | 103 | ||
104 | public object Exception | 104 | public object Exception |
105 | { | 105 | { |
106 | get { return (TResult)_workItemResult.Exception; } | 106 | get { return (TResult)_workItemResult.Exception; } |
107 | } | 107 | } |
108 | 108 | ||
109 | #region IInternalWorkItemResult Members | 109 | #region IInternalWorkItemResult Members |
110 | 110 | ||
111 | public IWorkItemResult GetWorkItemResult() | 111 | public IWorkItemResult GetWorkItemResult() |
112 | { | 112 | { |
113 | return _workItemResult.GetWorkItemResult(); | 113 | return _workItemResult.GetWorkItemResult(); |
114 | } | 114 | } |
115 | 115 | ||
116 | public IWorkItemResult<TRes> GetWorkItemResultT<TRes>() | 116 | public IWorkItemResult<TRes> GetWorkItemResultT<TRes>() |
117 | { | 117 | { |
118 | return (IWorkItemResult<TRes>)this; | 118 | return (IWorkItemResult<TRes>)this; |
119 | } | 119 | } |
120 | 120 | ||
121 | #endregion | 121 | #endregion |
122 | 122 | ||
123 | #endregion | 123 | #endregion |
124 | } | 124 | } |
125 | 125 | ||
126 | #endregion | 126 | #endregion |
127 | 127 | ||
128 | } | 128 | } |