2009-09-23 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Wed, 23 Sep 2009 12:58:58 +0000 (12:58 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Wed, 23 Sep 2009 12:58:58 +0000 (12:58 -0000)
* ExecutionContext.cs: Don't use SecurityContext and don't expose
AsyncFlowControl for NET_2_1
* ThreadAbortException.cs: Remove ExceptionState from NET_2_1
* Thread.cs: Don't expose ApartmentState and remove Suspend and
Resume methods for NET_2_1
* ThreadPool.cs: Remove GetAvailableThreads and Unsafe* methods
for NET_2_1

svn path=/trunk/mcs/; revision=142481

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/ThreadAbortException.cs
mcs/class/corlib/System.Threading/ThreadPool.cs

index 55265fa25d5b2d76656738e47b1788b98dd5f5c6..81552dce1c088d640bb8929a78ddb09d426e8022 100644 (file)
@@ -1,3 +1,13 @@
+2009-09-23  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * ExecutionContext.cs: Don't use SecurityContext and don't expose
+       AsyncFlowControl for NET_2_1
+       * ThreadAbortException.cs: Remove ExceptionState from NET_2_1
+       * Thread.cs: Don't expose ApartmentState and remove Suspend and
+       Resume methods for NET_2_1
+       * ThreadPool.cs: Remove GetAvailableThreads and Unsafe* methods
+       for NET_2_1
+
 2009-09-22  Jb Evain  <jbevain@novell.com>
 
        * Timer.cs: MONOTOUCH doesn't support remoting, so do not pass
index 546b73eed1d0ecd445eed60de60e22470265ef76..f3adffee767c892fa848a6f53885680bccb4f3ec 100644 (file)
@@ -40,7 +40,9 @@ namespace System.Threading {
 #else
        internal sealed class ExecutionContext : ISerializable {
 #endif
+#if !NET_2_1
                private SecurityContext _sc;
+#endif
                private bool _suppressFlow;
                private bool _capture;
 
@@ -50,8 +52,10 @@ namespace System.Threading {
 
                internal ExecutionContext (ExecutionContext ec)
                {
+#if !NET_2_1
                        if (ec._sc != null)
                                _sc = new SecurityContext (ec._sc);
+#endif
                        _suppressFlow = ec._suppressFlow;
                        _capture = true;
                }
@@ -69,8 +73,10 @@ namespace System.Threading {
                                return null;
 
                        ExecutionContext capture = new ExecutionContext (ec);
+#if !NET_2_1
                        if (SecurityManager.SecurityEnabled)
                                capture.SecurityContext = SecurityContext.Capture ();
+#endif
                        return capture;
                }
                
@@ -92,7 +98,7 @@ namespace System.Threading {
                }
                
                // internal stuff
-
+#if !NET_2_1
                internal SecurityContext SecurityContext {
                        get {
                                if (_sc == null)
@@ -101,7 +107,7 @@ namespace System.Threading {
                        }
                        set { _sc = value; }
                }
-
+#endif
                internal bool FlowSuppressed {
                        get { return _suppressFlow; }
                        set { _suppressFlow = value; }
@@ -140,11 +146,13 @@ namespace System.Threading {
                        SecurityContext.Run (executionContext.SecurityContext, callback, state);
                }
 #endif
+#if !NET_2_1
                public static AsyncFlowControl SuppressFlow ()
                {
                        Thread t = Thread.CurrentThread;
                        t.ExecutionContext.FlowSuppressed = true;
                        return new AsyncFlowControl (t, AsyncFlowControlType.Execution);
                }
+#endif
        }
 }
index fb2519cbafa02869e575fc01d1366690a3a5f383..500ce2dcb07849b7a00409faa65423d89b6ae96e 100644 (file)
@@ -98,7 +98,11 @@ namespace System.Threading {
                private bool thread_dump_requested;
                private IntPtr end_stack;
                private bool thread_interrupt_requested;
+#if NET_2_1
+               private byte apartment_state;
+#else
                private byte apartment_state = (byte)ApartmentState.Unknown;
+#endif
                volatile int critical_region_level;
                private int small_id;
                private IntPtr manage_callback;
@@ -130,7 +134,7 @@ namespace System.Threading {
                [ThreadStatic]
                static ExecutionContext _ec;
 
-               // can be both a ThreadSart and a ParameterizedThreadStart
+               // can be both a ThreadStart and a ParameterizedThreadStart
                private MulticastDelegate threadstart;
                //private string thread_name=null;
 
@@ -330,6 +334,7 @@ namespace System.Threading {
                        Thread_init ();
                }
 
+#if !NET_2_1
 #if NET_2_0
                [Obsolete ("Deprecated in favor of GetApartmentState, SetApartmentState and TrySetApartmentState.")]
 #endif
@@ -361,6 +366,7 @@ namespace System.Threading {
 #endif
                        }
                }
+#endif // !NET_2_1
 
                //[MethodImplAttribute (MethodImplOptions.InternalCall)]
                //private static extern int current_lcid ();
@@ -641,6 +647,7 @@ namespace System.Threading {
                        }
                }
 
+#if !NET_2_1
                public ThreadPriority Priority {
                        get {
                                return(ThreadPriority.Lowest);
@@ -650,6 +657,7 @@ namespace System.Threading {
                                // FIXME: Implement setter.
                        }
                }
+#endif
 
                public ThreadState ThreadState {
                        get {
@@ -666,6 +674,7 @@ namespace System.Threading {
                        Abort_internal (null);
                }
 
+#if !NET_2_1
                [SecurityPermission (SecurityAction.Demand, ControlThread=true)]
                public void Abort (object stateInfo) 
                {
@@ -683,6 +692,7 @@ namespace System.Threading {
                {
                        Interrupt_internal ();
                }
+#endif
 
                // The current thread joins with 'this'. Set ms to 0 to block
                // until this actually exits.
@@ -702,6 +712,7 @@ namespace System.Threading {
                        return Join_internal(millisecondsTimeout, system_thread_handle);
                }
 
+#if !NET_2_1
                public bool Join(TimeSpan timeout)
                {
                        // LAMESPEC: says to throw ArgumentException too
@@ -712,11 +723,14 @@ namespace System.Threading {
                        }
                        return Join_internal(ms, system_thread_handle);
                }
+#endif
 
 #if NET_1_1
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public extern static void MemoryBarrier ();
 #endif
+
+#if !NET_2_1
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private extern void Resume_internal();
 
@@ -728,6 +742,7 @@ namespace System.Threading {
                {
                        Resume_internal ();
                }
+#endif // !NET_2_1
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                private extern static void SpinWait_nop ();
@@ -805,6 +820,7 @@ namespace System.Threading {
                                throw new SystemException ("Thread creation failed.");
                }
 
+#if !NET_2_1
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private extern void Suspend_internal();
 
@@ -816,6 +832,7 @@ namespace System.Threading {
                {
                        Suspend_internal ();
                }
+#endif // !NET_2_1
 
                // Closes the system thread handle
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -1013,7 +1030,8 @@ namespace System.Threading {
                {
                        // Managed and native threads are currently bound together.
                }
-               
+
+#if !NET_2_1
                public ApartmentState GetApartmentState ()
                {
                        return (ApartmentState)apartment_state;
@@ -1041,6 +1059,7 @@ namespace System.Threading {
 
                        return true;
                }
+#endif // !NET_2_1
                
                [ComVisible (false)]
                public override int GetHashCode ()
index 3960a6abdf033018fb0db6303a728abe78a644c4..b06f6a376778849d2b91746e8c5200c4403bb66f 100644 (file)
@@ -54,10 +54,12 @@ namespace System.Threading
                {
                }
 
+#if !NET_2_1
                public object ExceptionState {
                        get {
                                return Thread.CurrentThread.GetAbortExceptionState ();
                        }
                }
+#endif
        }
 }
index 9dc755dcaf4c94ed7497001cb8219d0200a4086e..d6cdf041ad95977fe3638b75e1cf444d86dc83ad 100644 (file)
@@ -66,10 +66,11 @@ namespace System.Threading {
                        return true;
                }
 #endif
-               
+
+#if !NET_2_1           
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public static extern void GetAvailableThreads (out int workerThreads, out int completionPortThreads);
-
+#endif
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public static extern void GetMaxThreads (out int workerThreads, out int completionPortThreads);
                        
@@ -156,6 +157,8 @@ namespace System.Threading {
                                                            (long) millisecondsTimeOutInterval, executeOnlyOnce);
                }
 
+#if !NET_2_1
+
 #if NET_2_0
                [CLSCompliant (false)]
                unsafe public static bool UnsafeQueueNativeOverlapped (NativeOverlapped *overlapped)
@@ -219,6 +222,8 @@ namespace System.Threading {
                        throw new NotImplementedException ();
                }
 
+#endif
+
 #if NET_2_1 && !MONOTOUCH
                static WaitCallback MoonlightHandler (WaitCallback callback)
                {