From d4307f63afedb945345ce760867772da5280b9a8 Mon Sep 17 00:00:00 2001 From: nosami Date: Wed, 15 Feb 2023 14:12:14 +0000 Subject: [PATCH] Ensure all threads have started before test pauses --- .../BreakpointsAndStepping.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/UnitTests/MonoDevelop.Debugger.Tests.TestApp/BreakpointsAndStepping.cs b/UnitTests/MonoDevelop.Debugger.Tests.TestApp/BreakpointsAndStepping.cs index 76e9390d..fe062bd5 100644 --- a/UnitTests/MonoDevelop.Debugger.Tests.TestApp/BreakpointsAndStepping.cs +++ b/UnitTests/MonoDevelop.Debugger.Tests.TestApp/BreakpointsAndStepping.cs @@ -61,12 +61,19 @@ public void FunctionBreakpoint () public void MultipleThreads () { + var threadStart = new ManualResetEvent(false); for (var i = 0; i < 10; i++) { - var thread = new Thread(() => Thread.Sleep(10000)); - + var thread = new Thread(() => + { + threadStart.Set(); + Thread.Sleep(10000); + }); + thread.IsBackground = true; thread.Name = "Thread " + i; thread.Start(); + threadStart.WaitOne(); + threadStart.Reset(); } Console.WriteLine("Done"); /*536f5570-c182-4d21-ad23-ae9f6a8b2892*/