[Mono-bugs] [Bug 81476][Wis] New - Thread.Start() deadlock

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Apr 27 16:11:04 EDT 2007


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 alan.mcgovern at gmail.com.

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

--- shadow/81476	2007-04-27 16:11:04.000000000 -0400
+++ shadow/81476.tmp.15891	2007-04-27 16:11:04.000000000 -0400
@@ -0,0 +1,52 @@
+Bug#: 81476
+Product: Mono: Class Libraries
+Version: 1.2
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: alan.mcgovern at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Thread.Start() deadlock
+
+Running the following testcase on mono results in a deadlock 99% of the
+time. I tracked the problem down to calls to Thread.Start() never
+returning. The problem isn't part of the Timer code, but it does highlight
+the issue.
+
+using System;
+using System.Threading;
+
+public class Test {
+        public static void Main(string[] arg) {
+                for (int i = 0; i < 10; i++)
+                        new Thread(new Test(i).Runner).Start();
+        }
+
+        int tid;
+        Timer timer;
+
+        public Test(int tid) { this.tid = tid; }
+
+        public void Runner() {
+                Console.Error.WriteLine("Thread {0} Starting", tid);
+
+                timer = new Timer(Callback, null, 50, 50);
+                //timer.Dispose(); // MySQL disposes right away in the
+usual case
+
+                Console.Error.WriteLine("Thread {0} Finished", tid);
+        }
+
+        void Callback(object state) {
+                Console.Error.WriteLine("Callback on Thread: {0}", tid);
+                timer.Dispose();
+        }
+}


More information about the mono-bugs mailing list