use MOONLIGHT symbol
authorJb Evain <jbevain@gmail.com>
Tue, 16 Mar 2010 12:11:37 +0000 (12:11 -0000)
committerJb Evain <jbevain@gmail.com>
Tue, 16 Mar 2010 12:11:37 +0000 (12:11 -0000)
svn path=/trunk/mcs/; revision=153658

mcs/class/corlib/System.Threading/ChangeLog
mcs/class/corlib/System.Threading/ExecutionContext.cs
mcs/class/corlib/System.Threading/Thread.cs
mcs/class/corlib/System.Threading/ThreadPool.cs

index 41ef999b0324dc039b84704e5b15f64dbe932a3d..d2450313673c6edba82b42b5e9e47696da2e428d 100644 (file)
@@ -1,3 +1,8 @@
+2010-03-16  Jb Evain  <jbevain@novell.com>
+
+       * ThreadPool.cs, Thread.cs, ExecutionContext.cs: use MOONLIGHT
+       symbol to disambiguate MonoTouch and Moonlight code.
+
 2010-03-08  Jérémie Laval  <jeremie.laval@gmail.com>
 
        * SpinLock.cs: Merge algorithm back in SpinLock struct
index 6deff9db0e222052e26516008bb8410a77d778a6..684caf0a2e4fc928c72e11a6fe4ae096e2563c71 100644 (file)
@@ -36,7 +36,7 @@ namespace System.Threading {
 
        [Serializable]
        public sealed class ExecutionContext : ISerializable {
-#if !NET_2_1 || MONOTOUCH
+#if !MOONLIGHT
                private SecurityContext _sc;
 #endif
                private bool _suppressFlow;
@@ -48,7 +48,7 @@ namespace System.Threading {
 
                internal ExecutionContext (ExecutionContext ec)
                {
-#if !NET_2_1 || MONOTOUCH
+#if !MOONLIGHT
                        if (ec._sc != null)
                                _sc = new SecurityContext (ec._sc);
 #endif
@@ -69,7 +69,7 @@ namespace System.Threading {
                                return null;
 
                        ExecutionContext capture = new ExecutionContext (ec);
-#if !NET_2_1 || MONOTOUCH
+#if !MOONLIGHT
                        if (SecurityManager.SecurityEnabled)
                                capture.SecurityContext = SecurityContext.Capture ();
 #endif
@@ -94,7 +94,7 @@ namespace System.Threading {
                }
                
                // internal stuff
-#if !NET_2_1 || MONOTOUCH
+#if !MOONLIGHT
                internal SecurityContext SecurityContext {
                        get {
                                if (_sc == null)
@@ -127,7 +127,7 @@ namespace System.Threading {
                        ec.FlowSuppressed = false;
                }
 
-#if !NET_2_1 || MONOTOUCH
+#if !MOONLIGHT
                [MonoTODO ("only the SecurityContext is considered")]
                [SecurityPermission (SecurityAction.LinkDemand, Infrastructure = true)]
                public static void Run (ExecutionContext executionContext, ContextCallback callback, object state)
index 86e797c764815b88fd3bc9ad93a5a3f9d36b8641..60b3871f61559f8ccc348e365bb85e82ff24e3e6 100644 (file)
@@ -197,7 +197,7 @@ namespace System.Threading {
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private extern static byte[] ByteArrayToCurrentDomain (byte[] arr);
 
-#if !NET_2_1 || MONOTOUCH
+#if !MOONLIGHT
                public static IPrincipal CurrentPrincipal {
                        get {
                                Thread th = CurrentThread;
@@ -262,7 +262,7 @@ namespace System.Threading {
                        }
                }
 
-#if !NET_2_1 || MONOTOUCH
+#if !MOONLIGHT
                // Stores a hash keyed by strings of LocalDataStoreSlot objects
                static Hashtable datastorehash;
                private static object datastore_lock = new object ();
@@ -404,7 +404,7 @@ namespace System.Threading {
                        internal_thread = it;
                }
 
-#if !NET_2_1 || MONOTOUCH
+#if !MOONLIGHT
                [Obsolete ("Deprecated in favor of GetApartmentState, SetApartmentState and TrySetApartmentState.")]
                public ApartmentState ApartmentState {
                        get {
@@ -681,7 +681,7 @@ namespace System.Threading {
                        }
                }
 
-#if !NET_2_1 || MONOTOUCH
+#if !MOONLIGHT
                public ThreadPriority Priority {
                        get {
                                return(ThreadPriority.Lowest);
@@ -708,7 +708,7 @@ namespace System.Threading {
                        Abort_internal (Internal, null);
                }
 
-#if !NET_2_1 || MONOTOUCH
+#if !MOONLIGHT
                [SecurityPermission (SecurityAction.Demand, ControlThread=true)]
                public void Abort (object stateInfo) 
                {
@@ -746,7 +746,7 @@ namespace System.Threading {
                        return Join_internal (Internal, millisecondsTimeout, Internal.system_thread_handle);
                }
 
-#if !NET_2_1 || MONOTOUCH
+#if !MOONLIGHT
                public bool Join(TimeSpan timeout)
                {
                        long ms = (long) timeout.TotalMilliseconds;
@@ -762,7 +762,7 @@ namespace System.Threading {
                public extern static void MemoryBarrier ();
 #endif
 
-#if !NET_2_1 || MONOTOUCH
+#if !MOONLIGHT
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private extern void Resume_internal();
 
@@ -789,7 +789,7 @@ namespace System.Threading {
                        }
                }
 
-#if NET_2_1 && !MONOTOUCH
+#if MOONLIGHT
                private void StartSafe ()
                {
                        current_thread = this;
@@ -847,7 +847,7 @@ namespace System.Threading {
                        Internal._serialized_principal = CurrentThread.Internal._serialized_principal;
 
                        // Thread_internal creates and starts the new thread, 
-#if NET_2_1 && !MONOTOUCH
+#if MOONLIGHT
                        if (Thread_internal((ThreadStart) StartSafe) == (IntPtr) 0)
 #else
                        if (Thread_internal((ThreadStart) StartUnsafe) == (IntPtr) 0)
@@ -855,7 +855,7 @@ namespace System.Threading {
                                throw new SystemException ("Thread creation failed.");
                }
 
-#if !NET_2_1 || MONOTOUCH
+#if !MOONLIGHT
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private extern static void Suspend_internal(InternalThread thread);
 
@@ -1049,7 +1049,7 @@ namespace System.Threading {
                        // Managed and native threads are currently bound together.
                }
 
-#if !NET_2_1 || MONOTOUCH
+#if !MOONLIGHT
                public ApartmentState GetApartmentState ()
                {
                        return (ApartmentState)Internal.apartment_state;
@@ -1091,7 +1091,7 @@ namespace System.Threading {
                        Start ();
                }
 
-#if !NET_2_1 || MONOTOUCH
+#if !MOONLIGHT
                // NOTE: This method doesn't show in the class library status page because
                // it cannot be "found" with the StrongNameIdentityPermission for ECMA key.
                // But it's there!
index 21578734bd630329c4d25f9562e242b9d31b8948..689a6bcf1200bcb8c30ce4d8353a62b96f93283e 100644 (file)
@@ -82,7 +82,7 @@ namespace System.Threading {
                        if (callBack == null)
                                throw new ArgumentNullException ("callBack");
 
-#if NET_2_1 && !MONOTOUCH
+#if MOONLIGHT
                        callBack = MoonlightHandler (callBack);
 #endif
                        IAsyncResult ar = callBack.BeginInvoke (state, null, null);
@@ -208,7 +208,7 @@ namespace System.Threading {
 
 #endif
 
-#if NET_2_1 && !MONOTOUCH
+#if MOONLIGHT
                static WaitCallback MoonlightHandler (WaitCallback callback)
                {
                        return delegate (object o) {