[Mono-bugs] [Bug 24967] New - Thread.Start(new ThreadStart(Meth)) ends too soon.

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
20 May 2002 08:14:36 -0000


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 ndrochak@gol.com.

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

--- shadow/24967	Mon May 20 04:14:36 2002
+++ shadow/24967.tmp.19642	Mon May 20 04:14:36 2002
@@ -0,0 +1,55 @@
+Bug#: 24967
+Product: Mono/Runtime
+Version: unspecified
+OS: Red Hat 7.2
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ndrochak@gol.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Thread.Start(new ThreadStart(Meth)) ends too soon. 
+
+The following sample code should just wait for a Control-C, writing 
+out "Inside Method" forever. It does so on MS.NET, but on mono it:
+
+  Prints "RESULT: 0"
+  Prints "Press Control-C to stop"
+  Prints "Inside Method" about 49 times and then stops.
+
+Here's the sample code:
+------------------------------------------------
+using System;
+using System.Threading;
+
+namespace NS {
+	class Class1
+	{
+		/// <summary>
+		/// The main entry point for the application.
+		/// </summary>
+		static void Main(string[] args)
+		{
+			Class1 o = new Class1();
+			Console.WriteLine("Press Control-C to stop");
+			o.DoIt();
+		}
+
+		public void DoIt() {
+			Thread t = new Thread(new ThreadStart(JustWait));
+			t.Start();
+		}
+
+		public void JustWait() {
+			while (true) {
+				Console.WriteLine("Inside Method");
+			}
+		}
+	}
+}