Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a CAS regalloc test.

  • Loading branch information...
commit 10b55da9e1e84991cae375947d089ad39ad3cb52 1 parent 76b8500
@vargaz vargaz authored
Showing with 16 additions and 0 deletions.
  1. +16 −0 mono/tests/interlocked.cs
View
16 mono/tests/interlocked.cs
@@ -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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.