Jelajahi Sumber

use MOONLIGHT symbol

svn path=/trunk/mcs/; revision=153658
Jb Evain 16 tahun lalu
induk
melakukan
ba09e4ba86

+ 5 - 0
mcs/class/corlib/System.Threading/ChangeLog

@@ -1,3 +1,8 @@
+2010-03-16  Jb Evain  <[email protected]>
+
+	* ThreadPool.cs, Thread.cs, ExecutionContext.cs: use MOONLIGHT
+	symbol to disambiguate MonoTouch and Moonlight code.
+
 2010-03-08  Jérémie Laval  <[email protected]>
 
 	* SpinLock.cs: Merge algorithm back in SpinLock struct

+ 5 - 5
mcs/class/corlib/System.Threading/ExecutionContext.cs

@@ -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)

+ 12 - 12
mcs/class/corlib/System.Threading/Thread.cs

@@ -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!

+ 2 - 2
mcs/class/corlib/System.Threading/ThreadPool.cs

@@ -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) {