@@ -34,15 +34,17 @@ namespace Mono.Debugging.Evaluation
34
34
{
35
35
public class AsyncOperationManager : IDisposable
36
36
{
37
- List < AsyncOperation > operationsToCancel = new List < AsyncOperation > ( ) ;
37
+ readonly List < AsyncOperation > operationsToCancel = new List < AsyncOperation > ( ) ;
38
+ readonly object operationsSync = new object ( ) ;
39
+
38
40
internal bool Disposing ;
39
41
40
42
public void Invoke ( AsyncOperation methodCall , int timeout )
41
43
{
42
44
methodCall . Aborted = false ;
43
45
methodCall . Manager = this ;
44
46
45
- lock ( operationsToCancel ) {
47
+ lock ( operationsSync ) {
46
48
operationsToCancel . Add ( methodCall ) ;
47
49
methodCall . Invoke ( ) ;
48
50
}
@@ -51,9 +53,8 @@ public void Invoke (AsyncOperation methodCall, int timeout)
51
53
if ( ! methodCall . WaitForCompleted ( timeout ) ) {
52
54
bool wasAborted = methodCall . Aborted ;
53
55
methodCall . InternalAbort ( ) ;
54
- lock ( operationsToCancel ) {
56
+ lock ( operationsSync ) {
55
57
operationsToCancel . Remove ( methodCall ) ;
56
- ST . Monitor . PulseAll ( operationsToCancel ) ;
57
58
}
58
59
if ( wasAborted )
59
60
throw new EvaluatorAbortedException ( ) ;
@@ -65,9 +66,8 @@ public void Invoke (AsyncOperation methodCall, int timeout)
65
66
methodCall . WaitForCompleted ( System . Threading . Timeout . Infinite ) ;
66
67
}
67
68
68
- lock ( operationsToCancel ) {
69
+ lock ( operationsSync ) {
69
70
operationsToCancel . Remove ( methodCall ) ;
70
- ST . Monitor . PulseAll ( operationsToCancel ) ;
71
71
if ( methodCall . Aborted ) {
72
72
throw new EvaluatorAbortedException ( ) ;
73
73
}
@@ -81,7 +81,7 @@ public void Invoke (AsyncOperation methodCall, int timeout)
81
81
public void Dispose ( )
82
82
{
83
83
Disposing = true ;
84
- lock ( operationsToCancel ) {
84
+ lock ( operationsSync ) {
85
85
foreach ( AsyncOperation op in operationsToCancel ) {
86
86
op . InternalShutdown ( ) ;
87
87
}
@@ -91,7 +91,7 @@ public void Dispose ()
91
91
92
92
public void AbortAll ( )
93
93
{
94
- lock ( operationsToCancel ) {
94
+ lock ( operationsSync ) {
95
95
foreach ( AsyncOperation op in operationsToCancel )
96
96
op . InternalAbort ( ) ;
97
97
}
0 commit comments