[Mono-bugs] [Bug 41841][Maj] Changed - MonoEnumInfo requires ThreadSafety
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Mon, 28 Apr 2003 20:35:12 -0400 (EDT)
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 r.h.lee@attbi.com.
http://bugzilla.ximian.com/show_bug.cgi?id=41841
--- shadow/41841 Mon Apr 28 18:54:10 2003
+++ shadow/41841.tmp.23513 Mon Apr 28 20:35:12 2003
@@ -32,6 +32,56 @@
------- Additional Comments From gonzalo@ximian.com 2003-04-28 18:54 -------
If you provide a test case that make that actually fail, I'll put the
changes back in. I reverted them cause lupus commented (and I agreed):
"the worst that can happen is that very seldomly a few more icalls are
done and the values/names will need to be recreated. No big deal
since it will basically never happen anyway."
+
+------- Additional Comments From r.h.lee@attbi.com 2003-04-28 20:35 -------
+Calling any static Enum.<functiondecl> that maps to the internal
+hashtable will reveal the bug.
+
+//
+// Richard Lee
+// r.h.lee@attbi.com
+//
+//
+using System;
+using System.Threading;
+
+ public class App {
+ enum Test {A=0,B=1,C=2,D=3,E=4,}
+
+ private bool _go;
+ private void _thandler() {
+ string fmt="A, B, C";
+
+ while (!_go) {}
+ for (int i=0; i<10000; ++i) {
+ Enum.Parse (typeof(Test), fmt);
+ }
+ }
+
+ public void Test1() {
+ int threadC=2;
+ Thread[] threads=new Thread[threadC];
+
+ _go=false;
+ for (int i=0; i<threadC; ++i) {
+ threads[i]=new Thread (
+ new ThreadStart (_thandler));
+ threads[i].Start ();
+ }
+ _go=true;
+ Thread.Sleep (1000);
+ }
+
+ public static void Main (string[] Args) {
+ App test = new App ();
+ test.Test1 ();
+ }
+ }
+
+If lupus would like a document, I'd be glad to provide one ;)
+http://www.wikipedia.org/wiki/Thread_safety
+
+