2 using System.Threading;
5 public static int Main () {
6 int n2 = 0, n1 = 1, n, i;
11 Interlocked.CompareExchange (ref n, n2 + n1, n);
13 Interlocked.CompareExchange (ref n2, n1, n2);
15 Interlocked.CompareExchange (ref n1, n, n1);
17 Interlocked.CompareExchange (ref i, i + 1, i);