Use wider acceptance criteria to cope with nested child Task waiting and external...
authorJérémie Laval <jeremie.laval@gmail.com>
Thu, 6 Jan 2011 11:23:40 +0000 (11:23 +0000)
committerJérémie Laval <jeremie.laval@gmail.com>
Thu, 6 Jan 2011 11:42:55 +0000 (11:42 +0000)
mcs/class/corlib/System.Threading.Tasks/Task.cs
mcs/class/corlib/System.Threading.Tasks/ThreadWorker.cs

index 45c869a217180739afb21edfb63ae15471019530..d072c518737a3d7914db28014fec6feceb2be6e9 100644 (file)
@@ -810,6 +810,12 @@ namespace System.Threading.Tasks
                                return taskId;
                        }
                }
+
+               internal Task Parent {
+                       get {
+                               return parent;
+                       }
+               }
                #endregion
        }
 }
index 757f38803d1f9aacf50aa03be09ae858a05fbba0..12d3eebbf8bac2b957f084a5fe0f035168dade06 100644 (file)
@@ -282,7 +282,7 @@ namespace System.Threading.Tasks
                
                static bool CheckTaskFitness (Task self, Task t)
                {
-                       return (t.CreationOptions & TaskCreationOptions.LongRunning) == 0 && t.Id < self.Id;
+                       return ((t.CreationOptions & TaskCreationOptions.LongRunning) == 0 && t.Id < self.Id) || t.Parent == self || t == self;
                }
                
                public bool Finished {