[Mono-bugs] [Bug 72738][Nor] New - Weird thread behavior

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 18 Feb 2005 15:06:56 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by adam@negligible.co.uk.

http://bugzilla.ximian.com/show_bug.cgi?id=72738

--- shadow/72738	2005-02-18 15:06:56.000000000 -0500
+++ shadow/72738.tmp.21339	2005-02-18 15:06:56.000000000 -0500
@@ -0,0 +1,50 @@
+Bug#: 72738
+Product: Mono: Class Libraries
+Version: 1.0
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: adam@negligible.co.uk               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Weird thread behavior
+
+When launching a thread, the ThreadState of the new thread can be
+"Unstarted" within the new thread! e.g. This test case  normally prints 6-7
+lines of output on my computer.
+
+using System;
+using System.Threading;
+
+public class MyClass 
+{
+	public static void Main ()
+	{
+		new MyClass ();
+	}
+	
+	Thread my_thread;
+	
+	public MyClass ()
+	{
+		for (int i = 0; i < 100; ++i)
+		{
+			my_thread = new Thread (new ThreadStart (MyLoop));
+			my_thread.Start ();
+			my_thread.Join ();
+		}
+	}
+	
+	void MyLoop ()
+	{
+		if (my_thread.ThreadState == ThreadState.Unstarted)
+			Console.WriteLine ("MyLoop: Argh - thread is 'unstarted'");
+	}
+}