@@ -35,16 +35,7 @@ namespace Mono.Debugging.Evaluation
35
35
{
36
36
public class AsyncOperationManager : IDisposable
37
37
{
38
- class OperationData
39
- {
40
- public IAsyncOperationBase Operation { get ; private set ; }
41
- public OperationData ( IAsyncOperationBase operation )
42
- {
43
- Operation = operation ;
44
- }
45
- }
46
-
47
- readonly HashSet < OperationData > currentOperations = new HashSet < OperationData > ( ) ;
38
+ readonly HashSet < IAsyncOperationBase > currentOperations = new HashSet < IAsyncOperationBase > ( ) ;
48
39
bool disposed = false ;
49
40
const int ShortCancelTimeout = 100 ;
50
41
@@ -70,13 +61,12 @@ public OperationResult<TValue> Invoke<TValue> (AsyncOperationBase<TValue> mc, in
70
61
71
62
Task < OperationResult < TValue > > task ;
72
63
var description = mc . Description ;
73
- var operationData = new OperationData ( mc ) ;
74
64
lock ( currentOperations ) {
75
65
if ( disposed )
76
66
throw new ObjectDisposedException ( "Already disposed" ) ;
77
67
DebuggerLoggingService . LogMessage ( string . Format ( "Starting invoke for {0}" , description ) ) ;
78
68
task = mc . InvokeAsync ( ) ;
79
- currentOperations . Add ( operationData ) ;
69
+ currentOperations . Add ( mc ) ;
80
70
}
81
71
82
72
bool cancelledAfterTimeout = false ;
@@ -111,7 +101,7 @@ public OperationResult<TValue> Invoke<TValue> (AsyncOperationBase<TValue> mc, in
111
101
}
112
102
finally {
113
103
lock ( currentOperations ) {
114
- currentOperations . Remove ( operationData ) ;
104
+ currentOperations . Remove ( mc ) ;
115
105
}
116
106
}
117
107
}
@@ -151,7 +141,7 @@ void WaitAfterCancel (IAsyncOperationBase op)
151
141
public void AbortAll ( )
152
142
{
153
143
DebuggerLoggingService . LogMessage ( "Aborting all the current invocations" ) ;
154
- List < OperationData > copy ;
144
+ List < IAsyncOperationBase > copy ;
155
145
lock ( currentOperations ) {
156
146
if ( disposed ) throw new ObjectDisposedException ( "Already disposed" ) ;
157
147
copy = currentOperations . ToList ( ) ;
@@ -161,14 +151,14 @@ public void AbortAll ()
161
151
CancelOperations ( copy , true ) ;
162
152
}
163
153
164
- void CancelOperations ( List < OperationData > operations , bool wait )
154
+ void CancelOperations ( List < IAsyncOperationBase > operations , bool wait )
165
155
{
166
- foreach ( var operationData in operations ) {
167
- var taskDescription = operationData . Operation . Description ;
156
+ foreach ( var operation in operations ) {
157
+ var taskDescription = operation . Description ;
168
158
try {
169
- operationData . Operation . Abort ( ) ;
159
+ operation . Abort ( ) ;
170
160
if ( wait ) {
171
- WaitAfterCancel ( operationData . Operation ) ;
161
+ WaitAfterCancel ( operation ) ;
172
162
}
173
163
}
174
164
catch ( Exception e ) {
@@ -185,7 +175,7 @@ void CancelOperations (List<OperationData> operations, bool wait)
185
175
186
176
public void Dispose ( )
187
177
{
188
- List < OperationData > copy ;
178
+ List < IAsyncOperationBase > copy ;
189
179
lock ( currentOperations ) {
190
180
if ( disposed ) throw new ObjectDisposedException ( "Already disposed" ) ;
191
181
disposed = true ;
0 commit comments