Revert the CER-like changes made to SpinLock.Enter method and document the problem.
[mono.git] / mcs / class / corlib / System.Threading / LazyInitializer.cs
index c63126ee57379b6abad59b650a9cdf7cf9bd069b..9b4ada957ac2836b4c450ea46af47b58d27b4332 100644 (file)
@@ -39,7 +39,8 @@ namespace System.Threading
                
                public static T EnsureInitialized<T> (ref T target, Func<T> initFunc) where T : class
                {
-                       Interlocked.CompareExchange (ref target, initFunc (), null);
+                       if (target == null)
+                               Interlocked.CompareExchange (ref target, initFunc (), null);
                        
                        return target;
                }