[runtime] Remove all NACL support. It was unmaintained for a long time. (#4955)
[mono.git] / mono / tests / interlocked.cs
index 3fe5ea57b1c4be25e2a26b77907576d652758944..d17a0a7bf7e4c548f025c9131d45725932f0b8fc 100644 (file)
@@ -30,6 +30,13 @@ public class InterlockTest
                if (it.test != 1)
                        return 4;
 
+               a = 10;
+               c = Interlocked.Exchange (ref a, 5);
+               if (c != 10)
+                       return 5;
+               if (a != 5)
+                       return 5;
+
                a = 1;
                b = Interlocked.Increment (ref a);
                if (a != 2)
@@ -54,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);
        }