[bcl] Fix a race in a Task test. Fixes #20921.

This commit is contained in:
Zoltan Varga committed 2014-07-12 00:31:47 +02:00
1 parent 2103f2394e
commit cd35ca1fe9
2 files changed
+6 -1

No files matched your search

@@ -449,6 +449,7 @@ namespace MonoTests.System.Runtime.CompilerServices {
th.Join ();
GC.Collect ();
GC.Collect ();
GC.WaitForPendingFinalizers ();
Assert.AreEqual (0, reachable, "#1");
}
@@ -904,7 +904,11 @@ namespace MonoTests.System.Threading.Tasks
args.SetObserved ();
};
var inner = new ApplicationException ();
Task.Factory.StartNew (() => { throw inner; });
Thread t = new Thread (delegate () {
Task.Factory.StartNew (() => { Console.WriteLine ("HIT!"); throw inner; });
});
t.Start ();
t.Join ();
Thread.Sleep (1000);
GC.Collect ();
Thread.Sleep (1000);