[sre] register a canonical MonoReflectionMethod for a methodref token
[mono.git] / mono / tests / interlocked.cs
index 450abadc558f4aecceb226e11a1bf7be46eacdba..d17a0a7bf7e4c548f025c9131d45725932f0b8fc 100644 (file)
@@ -61,11 +61,27 @@ public class InterlockTest
 
                Thread.MemoryBarrier ();
 
+               interlocked_regalloc1 ();
+
                Console.WriteLine ("done!");
 
                return 0;
        }
 
+       public static object[] buckets;
+       public static object segmentCache;
+
+       public static int interlocked_regalloc1 () {
+          int segment = 0;
+          buckets = new object [10];
+
+          if (buckets[segment] == null) {
+                  object newSegment = new Object ();
+                  segmentCache = Interlocked.CompareExchange (ref buckets[segment], newSegment, null) == null ? null : newSegment;
+          }
+          return 0;
+       }
+
        public static string IncTest () {
                return "A" + Interlocked.Increment (ref s_test);
        }