Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add a CAS regalloc test.

  • Loading branch information...
commit 10b55da9e1e84991cae375947d089ad39ad3cb52 1 parent 76b8500
Zoltan Varga vargaz authored

Showing 1 changed file with 16 additions and 0 deletions. Show diff stats Hide diff stats

  1. +16 0 mono/tests/interlocked.cs
16 mono/tests/interlocked.cs
@@ -61,11 +61,27 @@ public class InterlockTest
61 61
62 62 Thread.MemoryBarrier ();
63 63
  64 + interlocked_regalloc1 ();
  65 +
64 66 Console.WriteLine ("done!");
65 67
66 68 return 0;
67 69 }
68 70
  71 + public static object[] buckets;
  72 + public static object segmentCache;
  73 +
  74 + public static int interlocked_regalloc1 () {
  75 + int segment = 0;
  76 + buckets = new object [10];
  77 +
  78 + if (buckets[segment] == null) {
  79 + object newSegment = new Object ();
  80 + segmentCache = Interlocked.CompareExchange (ref buckets[segment], newSegment, null) == null ? null : newSegment;
  81 + }
  82 + return 0;
  83 + }
  84 +
69 85 public static string IncTest () {
70 86 return "A" + Interlocked.Increment (ref s_test);
71 87 }

0 comments on commit 10b55da

Please sign in to comment.
Something went wrong with that request. Please try again.