From e697335417cdd485549b396363bef62eef8a6d38 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 16 Feb 2017 07:20:41 -0500 Subject: [PATCH] [treadpool] Fix flaky System.Threading.ThreadTest.SetNameInThreadPoolThread test (#4392) --- .../Test/System.Threading/ThreadTest.cs | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/mcs/class/corlib/Test/System.Threading/ThreadTest.cs b/mcs/class/corlib/Test/System.Threading/ThreadTest.cs index ae5bdbfd586..a84fa27a77d 100644 --- a/mcs/class/corlib/Test/System.Threading/ThreadTest.cs +++ b/mcs/class/corlib/Test/System.Threading/ThreadTest.cs @@ -912,20 +912,18 @@ namespace MonoTests.System.Threading [Test] public void SetNameInThreadPoolThread () { - for (int i = 0; i < 10; ++i) { - Task t = Task.Run (delegate () { - Thread.CurrentThread.Name = "x/" + i; - Assert.AreEqual (Thread.CurrentThread.Name, "x/" + i, "#1"); + Task t = Task.Run (delegate () { + Thread.CurrentThread.Name = "ThreadName1"; + Assert.AreEqual (Thread.CurrentThread.Name, "ThreadName1", "#1"); - try { - Thread.CurrentThread.Name = "y/" + i; - Assert.Fail ("#2"); - } catch (InvalidOperationException) { - } - }); + try { + Thread.CurrentThread.Name = "ThreadName2"; + Assert.Fail ("#2"); + } catch (InvalidOperationException) { + } + }); - t.Wait (); - } + t.Wait (); } void CheckIsRunning (string s, Thread t) -- 2.25.1