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

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs/class
diff options
context:
space:
mode:
authorAlexander Köplinger <alex.koeplinger@outlook.com>2017-11-25 14:59:04 +0300
committerGitHub <noreply@github.com>2017-11-25 14:59:04 +0300
commit031405e9cc528631cee5bfa1e6f7b0fb54d47ada (patch)
tree253743db38f08b72aeb7ea6f197e71aa4001fe84 /mcs/class
parente8e92e5323c875b6709d03f212f43d29c1c2f523 (diff)
[corlib] Fix flaky ThreadPoolTests.AsyncLocalCapture test (#6099)
The test was added in https://github.com/mono/mono/commit/375471820c02ff0bab025bff75b5da7efc95d3cd. We were seeing some flakyness in the this test, looking at it I noticed that we were passing executeOnlyOnce = false to (Unsafe)RegisterWaitForSingleObject. This means that the delegate would be executed again whenever the AutoResetEvent `evt` is signaled or the timeout elapsed. The problem is that evt is never signaled by design and we set a timeout of 1ms which means we'd execute it in a tight loop. Setting executeOnlyOnce = true fixes this and I verified it doesn't change the intent of the test (i.e. the test still fails after the original commit is reverted). Bumped the timeout for the CountdownEvent as well to be safe since it's quite short.
Diffstat (limited to 'mcs/class')
-rw-r--r--mcs/class/corlib/Test/System.Threading/ThreadPoolTest.cs6
1 files changed, 3 insertions, 3 deletions
diff --git a/mcs/class/corlib/Test/System.Threading/ThreadPoolTest.cs b/mcs/class/corlib/Test/System.Threading/ThreadPoolTest.cs
index e86fd1d0e52..242e9cc8251 100644
--- a/mcs/class/corlib/Test/System.Threading/ThreadPoolTest.cs
+++ b/mcs/class/corlib/Test/System.Threading/ThreadPoolTest.cs
@@ -240,14 +240,14 @@ namespace MonoTests.System.Threading
ThreadPool.RegisterWaitForSingleObject (evt, (state, to) => {
var_2 = asyncLocal.Value;
cw.Signal ();
- }, null, 1, false);
+ }, null, millisecondsTimeOutInterval: 1, executeOnlyOnce: true);
ThreadPool.UnsafeRegisterWaitForSingleObject (evt, (state, to) => {
var_3 = asyncLocal.Value;
cw.Signal ();
- }, null, 1, false);
+ }, null, millisecondsTimeOutInterval: 1, executeOnlyOnce: true);
- Assert.IsTrue (cw.Wait (1000), "cw_wait");
+ Assert.IsTrue (cw.Wait (2000), "cw_wait");
Assert.AreEqual (1, var_0, "var_0");
Assert.AreEqual (0, var_1, "var_1");