New tests.
[mono.git] / mcs / class / corlib / System.Threading / ExecutionContext.cs
index ed5575c3ba7178d172838e06728827bf6ff44725..684caf0a2e4fc928c72e11a6fe4ae096e2563c71 100644 (file)
@@ -35,12 +35,10 @@ using System.Security.Permissions;
 namespace System.Threading {
 
        [Serializable]
-#if NET_2_0
        public sealed class ExecutionContext : ISerializable {
-#else
-       internal sealed class ExecutionContext : ISerializable {
-#endif
+#if !MOONLIGHT
                private SecurityContext _sc;
+#endif
                private bool _suppressFlow;
                private bool _capture;
 
@@ -50,8 +48,10 @@ namespace System.Threading {
 
                internal ExecutionContext (ExecutionContext ec)
                {
+#if !MOONLIGHT
                        if (ec._sc != null)
                                _sc = new SecurityContext (ec._sc);
+#endif
                        _suppressFlow = ec._suppressFlow;
                        _capture = true;
                }
@@ -69,8 +69,10 @@ namespace System.Threading {
                                return null;
 
                        ExecutionContext capture = new ExecutionContext (ec);
+#if !MOONLIGHT
                        if (SecurityManager.SecurityEnabled)
                                capture.SecurityContext = SecurityContext.Capture ();
+#endif
                        return capture;
                }
                
@@ -92,7 +94,7 @@ namespace System.Threading {
                }
                
                // internal stuff
-
+#if !MOONLIGHT
                internal SecurityContext SecurityContext {
                        get {
                                if (_sc == null)
@@ -101,7 +103,7 @@ namespace System.Threading {
                        }
                        set { _sc = value; }
                }
-
+#endif
                internal bool FlowSuppressed {
                        get { return _suppressFlow; }
                        set { _suppressFlow = value; }
@@ -124,10 +126,11 @@ namespace System.Threading {
 
                        ec.FlowSuppressed = false;
                }
-#if NET_2_0
+
+#if !MOONLIGHT
                [MonoTODO ("only the SecurityContext is considered")]
                [SecurityPermission (SecurityAction.LinkDemand, Infrastructure = true)]
-               public static void Run (ExecutionContext executionContext, ContextCallback callBack, object state)
+               public static void Run (ExecutionContext executionContext, ContextCallback callback, object state)
                {
                        if (executionContext == null) {
                                throw new InvalidOperationException (Locale.GetText (
@@ -137,14 +140,15 @@ namespace System.Threading {
                        // FIXME: supporting more than one context (the SecurityContext)
                        // will requires a rewrite of this method
 
-                       SecurityContext.Run (executionContext.SecurityContext, callBack, state);
+                       SecurityContext.Run (executionContext.SecurityContext, callback, state);
                }
-#endif
+
                public static AsyncFlowControl SuppressFlow ()
                {
                        Thread t = Thread.CurrentThread;
                        t.ExecutionContext.FlowSuppressed = true;
                        return new AsyncFlowControl (t, AsyncFlowControlType.Execution);
                }
+#endif
        }
 }