Skip to content

Commit 73bcf8c

Browse files
committed
Separate lock object. Get rid of useful Monitor.Pulse()
1 parent 8d662b4 commit 73bcf8c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Mono.Debugging/Mono.Debugging.Evaluation/AsyncOperationManager.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,17 @@ namespace Mono.Debugging.Evaluation
3434
{
3535
public class AsyncOperationManager: IDisposable
3636
{
37-
List<AsyncOperation> operationsToCancel = new List<AsyncOperation> ();
37+
readonly List<AsyncOperation> operationsToCancel = new List<AsyncOperation> ();
38+
readonly object operationsSync = new object ();
39+
3840
internal bool Disposing;
3941

4042
public void Invoke (AsyncOperation methodCall, int timeout)
4143
{
4244
methodCall.Aborted = false;
4345
methodCall.Manager = this;
4446

45-
lock (operationsToCancel) {
47+
lock (operationsSync) {
4648
operationsToCancel.Add (methodCall);
4749
methodCall.Invoke ();
4850
}
@@ -51,9 +53,8 @@ public void Invoke (AsyncOperation methodCall, int timeout)
5153
if (!methodCall.WaitForCompleted (timeout)) {
5254
bool wasAborted = methodCall.Aborted;
5355
methodCall.InternalAbort ();
54-
lock (operationsToCancel) {
56+
lock (operationsSync) {
5557
operationsToCancel.Remove (methodCall);
56-
ST.Monitor.PulseAll (operationsToCancel);
5758
}
5859
if (wasAborted)
5960
throw new EvaluatorAbortedException ();
@@ -65,9 +66,8 @@ public void Invoke (AsyncOperation methodCall, int timeout)
6566
methodCall.WaitForCompleted (System.Threading.Timeout.Infinite);
6667
}
6768

68-
lock (operationsToCancel) {
69+
lock (operationsSync) {
6970
operationsToCancel.Remove (methodCall);
70-
ST.Monitor.PulseAll (operationsToCancel);
7171
if (methodCall.Aborted) {
7272
throw new EvaluatorAbortedException ();
7373
}
@@ -81,7 +81,7 @@ public void Invoke (AsyncOperation methodCall, int timeout)
8181
public void Dispose ()
8282
{
8383
Disposing = true;
84-
lock (operationsToCancel) {
84+
lock (operationsSync) {
8585
foreach (AsyncOperation op in operationsToCancel) {
8686
op.InternalShutdown ();
8787
}
@@ -91,7 +91,7 @@ public void Dispose ()
9191

9292
public void AbortAll ()
9393
{
94-
lock (operationsToCancel) {
94+
lock (operationsSync) {
9595
foreach (AsyncOperation op in operationsToCancel)
9696
op.InternalAbort ();
9797
}

0 commit comments

Comments
 (0)