Fix register allocation bug for ternary ops.
[mono.git] / mono / tests / interlocked-4.2.cs
1 using System;
2 using System.Threading;
3 public class DifferentialOperator
4 {
5         static void Main (string[] args)
6         {
7                 WeakReference weakref = null;
8                 Swap (ref weakref, new object ());
9                 if (weakref == null)
10                         throw new Exception ();
11         }
12         
13         static void Swap(ref WeakReference refNmsp, object o)
14         {
15                 WeakReference wref = refNmsp;
16                 if (wref != null)
17                 {
18                         Console.WriteLine ("Need this to make it pass");
19                 }
20                 Interlocked.CompareExchange<WeakReference>(ref refNmsp, new WeakReference(o), wref);
21         }
22 }