[runtime] Fix DISABLE_REFLECTION_EMIT build.
[mono.git] / mono / tests / interlocked-3.cs
1 using System;
2 using System.Threading;
3
4 public class main {
5         public static int Main () {
6                 int n2 = 0, n1 = 1, n, i;
7                 n = 0;
8                 i = 0;
9                 while (i < 10) {
10                         //n = n2 + n1;
11                         Interlocked.CompareExchange (ref n, n2 + n1, n);
12                         //n2 = n1;
13                         Interlocked.CompareExchange (ref n2, n1, n2);
14                         //n1 = n;
15                         Interlocked.CompareExchange (ref n1, n, n1);
16                         //i = i + 1;
17                         Interlocked.CompareExchange (ref i, i + 1, i);
18                 }
19                 if (n != 89)
20                         return 1;
21                 return 0;
22         }
23 }