Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan McGovern <alan.mcgovern@gmail.com>2016-03-31 06:10:16 +0300
committerAlan McGovern <alan.mcgovern@gmail.com>2016-03-31 06:10:16 +0300
commitc201a989b1fb5c29d7e75b03a0187325b2affd55 (patch)
treef68182028584adf9b881129b709646b2b22261b1 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools
parentc38cd1bc3b9d961bd391c0b02218b2dc0eda3095 (diff)
[Ide] Always complete the task when running CustomToolService.Update
If we get 5 updates one right after the other, we will hit the case where cancellation has been requested while we are waiting for the previous task to complete. Assume thread 1 is inside `await existingTask`. Thread 2 pops in, notices that there's an existing task for the file it's working on, cancels it and then places a new object in the `runningTasks` dictionary. Thread 2 now awaits the task associated with the old object in the `runningTasks` dictionary. Now thread 1 completes it's await and sees it has been cancelled. If it does not mark it's `task` as complete then thread 2 will be stuck forever.
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs4
1 files changed, 3 insertions, 1 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs
index 6847a6e3d8..af1182b763 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs
@@ -291,8 +291,10 @@ namespace MonoDevelop.Ide.CustomTools
// Maybe I was cancelled while I was waiting. In that case, the task has already been removed from
// the runningTasks collection
- if (cs.IsCancellationRequested)
+ if (cs.IsCancellationRequested) {
+ newTask.TrySetResult (true);
return;
+ }
// Execute the generator