[Mono-bugs] [Bug 71211][Blo] Changed - Interlocked.Increment not incrementing

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 13 Jan 2005 09:43:10 -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 lluis@ximian.com.

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

--- shadow/71211	2005-01-12 22:01:51.000000000 -0500
+++ shadow/71211.tmp.13008	2005-01-13 09:43:10.000000000 -0500
@@ -10,13 +10,12 @@
 Component: JIT
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: lluis@ximian.com               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
 URL: 
-Cc: 
 Summary: Interlocked.Increment not incrementing
 
 In remoting there is a Interlocked.Increment call that looks like it is not
 working properly. Try the following test case:
 
 using System;
@@ -74,6 +73,32 @@
 fdda253c_b881_48c0_ba96_88e36530bd76/1775489760_4.rem
 fdda253c_b881_48c0_ba96_88e36530bd76/1775489775_5.rem
 fdda253c_b881_48c0_ba96_88e36530bd76/1775489798_6.rem
 fdda253c_b881_48c0_ba96_88e36530bd76/1775489810_7.rem
 
 on HEAD
+
+------- Additional Comments From lluis@ximian.com  2005-01-13 09:43 -------
+A more simple test case:
+
+using System;
+using System.Threading;
+
+public class Client {
+	public static int num = 0;
+	
+	public static void Main (string[] args)
+	{
+		for (int n=0; n<10; n++) {
+			Thread t = new Thread (new ThreadStart (Run));
+			t.Start ();
+		}
+	}
+	
+	public static void Run ()
+	{
+		int n = Interlocked.Increment (ref num);
+		Console.WriteLine ("Num: {0}", n);
+	}
+}
+
+Maybe Patrik has something to say...