}
}
}
-
+#if !MONO
internal struct ThreadHandle
{
private IntPtr m_ptr;
m_ptr = pThread;
}
}
-
+#endif
// deliberately not [serializable]
[ClassInterface(ClassInterfaceType.None)]
[ComDefaultInterface(typeof(_Thread))]
[System.Runtime.InteropServices.ComVisible(true)]
- public sealed class Thread : CriticalFinalizerObject, _Thread
+ public sealed partial class Thread : CriticalFinalizerObject
+#if !MOBILE
+ , _Thread
+#endif
{
+#if !MONO
/*=========================================================================
** Data accessed from managed code that needs to be defined in
** ThreadBaseObject to maintain alignment between the two classes.
Contract.EndContractBlock();
SetStartHelper((Delegate)start,0); //0 will setup Thread with default stackSize
}
-
+#endif
[System.Security.SecuritySafeCritical] // auto-generated
public Thread(ThreadStart start, int maxStackSize) {
if (start == null) {
Contract.EndContractBlock();
SetStartHelper((Delegate)start, maxStackSize);
}
+
[System.Security.SecuritySafeCritical] // auto-generated
public Thread(ParameterizedThreadStart start) {
if (start == null) {
Contract.EndContractBlock();
SetStartHelper((Delegate)start, maxStackSize);
}
-
+#if !MONO
[ComVisible(false)]
public override int GetHashCode()
{
[ResourceExposure(ResourceScope.None)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern void StartInternal(IPrincipal principal, ref StackCrawlMark stackMark);
-#if FEATURE_COMPRESSEDSTACK
+#endif
+#if FEATURE_COMPRESSEDSTACK || MONO
/// <internalonly/>
[System.Security.SecurityCritical] // auto-generated_required
[DynamicSecurityMethodAttribute()]
{
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ThreadAPIsNotSupported"));
}
-
+#if !MONO
[System.Security.SecurityCritical] // auto-generated
[ResourceExposure(ResourceScope.None)]
[MethodImplAttribute(MethodImplOptions.InternalCall), ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[ResourceExposure(ResourceScope.None)]
[MethodImplAttribute(MethodImplOptions.InternalCall), ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
internal extern void RestoreAppDomainStack( IntPtr appDomainStack);
-
+#endif
/// <internalonly/>
[System.Security.SecurityCritical] // auto-generated_required
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ThreadAPIsNotSupported"));
}
#endif // #if FEATURE_COMPRESSEDSTACK
-
+#if !MONO
// Helper method to get a logical thread ID for StringBuilder (for
// correctness) and for FileStream's async code path (for perf, to
[ResourceExposure(ResourceScope.None)]
[MethodImplAttribute(MethodImplOptions.InternalCall), ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
private static extern Thread GetCurrentThreadNative();
-
+#endif
[System.Security.SecurityCritical] // auto-generated
private void SetStartHelper(Delegate start, int maxStackSize)
{
+#if MONO
+ maxStackSize = GetProcessDefaultStackSize(maxStackSize);
+#else
#if FEATURE_CORECLR
// We only support default stacks in CoreCLR
Contract.Assert(maxStackSize == 0);
// Only fully-trusted code is allowed to create "large" stacks. Partial-trust falls back to
// the default stack size.
ulong defaultStackSize = GetProcessDefaultStackSize();
+
if ((ulong)(uint)maxStackSize > defaultStackSize)
{
try
maxStackSize = (int)Math.Min(defaultStackSize, (ulong)(uint)int.MaxValue);
}
}
+#endif
#endif
ThreadHelper threadStartCallBack = new ThreadHelper(start);
SetStart(new ParameterizedThreadStart(threadStartCallBack.ThreadStart), maxStackSize);
}
}
-
+#if !MONO
[SecurityCritical]
[ResourceExposure(ResourceScope.None)]
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
[ResourceExposure(ResourceScope.None)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal extern void ClearAbortReason();
-
+#endif
} // End of class Thread