From: Ludovic Henry Date: Thu, 16 Feb 2017 12:20:41 +0000 (-0500) Subject: [treadpool] Fix flaky System.Threading.ThreadTest.SetNameInThreadPoolThread test... X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mono.git;a=commitdiff_plain;h=e697335417cdd485549b396363bef62eef8a6d38 [treadpool] Fix flaky System.Threading.ThreadTest.SetNameInThreadPoolThread test (#4392) --- 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)