[Mono-bugs] [Bug 80327][Wis] New - Background thread that won't die

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Dec 20 09:59:44 EST 2006


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=80327

--- shadow/80327	2006-12-20 09:59:44.000000000 -0500
+++ shadow/80327.tmp.9204	2006-12-20 09:59:44.000000000 -0500
@@ -0,0 +1,55 @@
+Bug#: 80327
+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: Background thread that won't die
+
+Steps to reproduce the problem:
+Compile and run the attached testcase. "Exiting" is printed, but the
+program never exits as the UdpClient is in a blocking receive.
+
+
+
+using System.Threading;
+using System;
+using System.Net.Sockets;
+using System.Net;
+namespace ConsoleApplication3
+{
+    class Program
+    {
+        static void Main(string[] args)
+        {
+            Thread s = new Thread(new ThreadStart(WontDie));
+            s.IsBackground = true;
+            s.Start();
+            System.Threading.Thread.Sleep(1000);
+            Console.WriteLine("Exiting");
+        }
+
+        private static void WontDie()
+        {
+            while (true)
+            {
+                IPEndPoint endpoint = new
+IPEndPoint(IPAddress.Parse("239.255.255.250"), 1900);
+                UdpClient s = new UdpClient();
+                byte[] buffer = new byte[1024];
+                s.Send(buffer, buffer.Length, endpoint);
+                s.Receive(ref endpoint);
+            }
+        }
+    }
+}


More information about the mono-bugs mailing list