[netcore] Implement/fix enum/nullable comparers.
[mono-project.git] / mono / tests / interlocked-3.cs
blob62c5253da64edcb696a8da9c395a924ee7b7ab70
1 using System;
2 using System.Threading;
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);
19 if (n != 89)
20 return 1;
21 return 0;