From: Jb Evain Date: Tue, 16 Mar 2010 12:11:37 +0000 (-0000) Subject: use MOONLIGHT symbol X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=ba09e4ba867310bf668d7d2c6cf70a7dddceecc0;p=mono.git use MOONLIGHT symbol svn path=/trunk/mcs/; revision=153658 --- diff --git a/mcs/class/corlib/System.Threading/ChangeLog b/mcs/class/corlib/System.Threading/ChangeLog index 41ef999b032..d2450313673 100644 --- a/mcs/class/corlib/System.Threading/ChangeLog +++ b/mcs/class/corlib/System.Threading/ChangeLog @@ -1,3 +1,8 @@ +2010-03-16 Jb Evain + + * ThreadPool.cs, Thread.cs, ExecutionContext.cs: use MOONLIGHT + symbol to disambiguate MonoTouch and Moonlight code. + 2010-03-08 Jérémie Laval * SpinLock.cs: Merge algorithm back in SpinLock struct diff --git a/mcs/class/corlib/System.Threading/ExecutionContext.cs b/mcs/class/corlib/System.Threading/ExecutionContext.cs index 6deff9db0e2..684caf0a2e4 100644 --- a/mcs/class/corlib/System.Threading/ExecutionContext.cs +++ b/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) diff --git a/mcs/class/corlib/System.Threading/Thread.cs b/mcs/class/corlib/System.Threading/Thread.cs index 86e797c7648..60b3871f615 100644 --- a/mcs/class/corlib/System.Threading/Thread.cs +++ b/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! diff --git a/mcs/class/corlib/System.Threading/ThreadPool.cs b/mcs/class/corlib/System.Threading/ThreadPool.cs index 21578734bd6..689a6bcf120 100644 --- a/mcs/class/corlib/System.Threading/ThreadPool.cs +++ b/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) {