[Mono-bugs] [Bug 71031][Wis] New - Threads in Monitor.Wait() Show Different State on .Net vs Mono

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 5 Jan 2005 16:33:21 -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 scott@imeem.com.

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

--- shadow/71031	2005-01-05 16:33:21.000000000 -0500
+++ shadow/71031.tmp.9308	2005-01-05 16:33:21.000000000 -0500
@@ -0,0 +1,81 @@
+Bug#: 71031
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: scott@imeem.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Threads in Monitor.Wait() Show Different State on .Net vs Mono
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+Threads which are waiting inside a Monitor.Wait() call still report their
+thread state as 'Running' under Mono, under .Net the thread reports that it
+is in the WaitSleepJoin state.
+
+
+
+Steps to reproduce the problem:
+Here's some code
+
+using System;
+using System.Threading;
+
+namespace monitor_wait_test
+{
+	class Class1
+	{
+		static object lockObj = new object();
+		/// <summary>
+		/// The main entry point for the application.
+		/// </summary>
+		[STAThread]
+		static void Main(string[] args)
+		{
+			Thread waitThread = new Thread(new ThreadStart(DoWait));
+			waitThread.Start();
+			Thread.Sleep(1000);
+			// other thread should now be waiting
+			Console.WriteLine("Waiting Thread State = " +
+waitThread.ThreadState.ToString());
+			Monitor.Enter(lockObj);
+			Monitor.Pulse(lockObj);
+			Monitor.Exit(lockObj);
+		}
+
+
+		static void DoWait() 
+		{
+			Monitor.Enter(lockObj);
+
+			Console.WriteLine("Waiting on lockObj");
+			Monitor.Wait(lockObj);
+			Console.WriteLine("Finished Waiting on LockObj");
+			Monitor.Exit(lockObj);
+		}
+	}
+}
+
+
+Actual Results:
+on Mono
+Waiting Thread State = Running
+
+Expected Results:
+on .Net
+Waiting Thread State = WaitSleepJoin
+
+How often does this happen? 
+Always
+
+Additional Information: