http://bugzilla.novell.com/show_bug.cgi?id=551228
User [email protected] added comment http://bugzilla.novell.com/show_bug.cgi?id=551228#c2 --- Comment #2 from Darryl Cain <[email protected]> 2009-10-29 21:41:03 MDT --- I changed the test program to be; .. for (int i = 0; i < n_threads; i++) { threads[i].Join(); } Thread.Sleep(1000); Console.WriteLine("Counter value: {0}", shared_counter); .. and still no difference (see below for results with two threads). I don't believe there is any problem with the joins. u...@host:~/code/tests> mono SharedCounter.exe 1000000 2 1000000 increments over 2 threads Counter value: 999744 u...@host:~/code/tests> mono SharedCounter.exe 1000000 2 1000000 increments over 2 threads Counter value: 999862 u...@host:~/code/tests> mono SharedCounter.exe 1000000 2 1000000 increments over 2 threads Counter value: 999821 Oddly, after some more testing I have found that if I change; private static object shared_lock = new object(); to private static readonly object shared_lock = new object(); I get the correct and desired results (same results as x86 and AMD64 systems without readonly). u...@host:~/code/tests> mono SharedCounter.exe 1000000 2 1000000 increments over 2 threads Counter value: 1000000 u...@host:~/code/tests> mono SharedCounter.exe 1000000 4 1000000 increments over 4 threads Counter value: 1000000 u...@host:~/code/tests> mono SharedCounter.exe 1000000 8 1000000 increments over 8 threads Counter value: 1000000 u...@host:~/code/tests> mono SharedCounter.exe 1000000 16 1000000 increments over 16 threads Counter value: 1000000 I shall try and figure out what the runtime is doing differently based on this attribute (because presumably it is stored in the same place, presumably it is using the same Monitor mechanisms, the only different is the enforcement of single assignment semantics within the compiler). Whilst this may fix the test program, other programs will still be broken if there is any locking performed on mutable state. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
