+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
#else
internal sealed class ExecutionContext : ISerializable {
#endif
+#if !NET_2_1
private SecurityContext _sc;
+#endif
private bool _suppressFlow;
private bool _capture;
internal ExecutionContext (ExecutionContext ec)
{
+#if !NET_2_1
if (ec._sc != null)
_sc = new SecurityContext (ec._sc);
+#endif
_suppressFlow = ec._suppressFlow;
_capture = true;
}
return null;
ExecutionContext capture = new ExecutionContext (ec);
+#if !NET_2_1
if (SecurityManager.SecurityEnabled)
capture.SecurityContext = SecurityContext.Capture ();
+#endif
return capture;
}
}
// internal stuff
-
+#if !NET_2_1
internal SecurityContext SecurityContext {
get {
if (_sc == null)
}
set { _sc = value; }
}
-
+#endif
internal bool FlowSuppressed {
get { return _suppressFlow; }
set { _suppressFlow = value; }
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
}
}
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;
[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;
Thread_init ();
}
+#if !NET_2_1
#if NET_2_0
[Obsolete ("Deprecated in favor of GetApartmentState, SetApartmentState and TrySetApartmentState.")]
#endif
#endif
}
}
+#endif // !NET_2_1
//[MethodImplAttribute (MethodImplOptions.InternalCall)]
//private static extern int current_lcid ();
}
}
+#if !NET_2_1
public ThreadPriority Priority {
get {
return(ThreadPriority.Lowest);
// FIXME: Implement setter.
}
}
+#endif
public ThreadState ThreadState {
get {
Abort_internal (null);
}
+#if !NET_2_1
[SecurityPermission (SecurityAction.Demand, ControlThread=true)]
public void Abort (object stateInfo)
{
{
Interrupt_internal ();
}
+#endif
// The current thread joins with 'this'. Set ms to 0 to block
// until this actually exits.
return Join_internal(millisecondsTimeout, system_thread_handle);
}
+#if !NET_2_1
public bool Join(TimeSpan timeout)
{
// LAMESPEC: says to throw ArgumentException too
}
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();
{
Resume_internal ();
}
+#endif // !NET_2_1
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern static void SpinWait_nop ();
throw new SystemException ("Thread creation failed.");
}
+#if !NET_2_1
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern void Suspend_internal();
{
Suspend_internal ();
}
+#endif // !NET_2_1
// Closes the system thread handle
[MethodImplAttribute(MethodImplOptions.InternalCall)]
{
// Managed and native threads are currently bound together.
}
-
+
+#if !NET_2_1
public ApartmentState GetApartmentState ()
{
return (ApartmentState)apartment_state;
return true;
}
+#endif // !NET_2_1
[ComVisible (false)]
public override int GetHashCode ()
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);
(long) millisecondsTimeOutInterval, executeOnlyOnce);
}
+#if !NET_2_1
+
#if NET_2_0
[CLSCompliant (false)]
unsafe public static bool UnsafeQueueNativeOverlapped (NativeOverlapped *overlapped)
throw new NotImplementedException ();
}
+#endif
+
#if NET_2_1 && !MONOTOUCH
static WaitCallback MoonlightHandler (WaitCallback callback)
{