Imported Upstream version 6.0.0.172

Former-commit-id: f3cc9b82f3e5bd8f0fd3ebc098f789556b44e9cd
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-04-12 14:10:50 +00:00
parent 8016999e4d
commit 64ac736ec5
32155 changed files with 3981439 additions and 75368 deletions

View File

@ -27,11 +27,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.Remoting.Contexts;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Security.Permissions;
using System.Security.Principal;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@ -42,6 +38,12 @@ using System.Security;
using System.Diagnostics;
using System.Runtime.ConstrainedExecution;
#if !NETCORE
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Remoting.Contexts;
using System.Security.Principal;
#endif
namespace System.Threading {
[StructLayout (LayoutKind.Sequential)]
sealed class InternalThread : CriticalFinalizerObject {
@ -115,7 +117,10 @@ namespace System.Threading {
}
[StructLayout (LayoutKind.Sequential)]
public sealed partial class Thread {
#if !NETCORE
public
#endif
sealed partial class Thread {
#pragma warning disable 414
#region Sync with metadata/object-internals.h
private InternalThread internal_thread;
@ -124,9 +129,6 @@ namespace System.Threading {
#endregion
#pragma warning restore 414
IPrincipal principal;
int principal_version;
// the name of current_thread is
// important because they are used by the runtime.
@ -151,13 +153,6 @@ namespace System.Threading {
}
}
public static Context CurrentContext {
[SecurityPermission (SecurityAction.LinkDemand, Infrastructure=true)]
get {
return(AppDomain.InternalGetContext ());
}
}
/*
* These two methods return an array in the target
* domain with the same content as the argument. If
@ -170,6 +165,16 @@ namespace System.Threading {
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static byte[] ByteArrayToCurrentDomain (byte[] arr);
#if !NETCORE
IPrincipal principal;
int principal_version;
public static Context CurrentContext {
get {
return(AppDomain.InternalGetContext ());
}
}
static void DeserializePrincipal (Thread th)
{
MemoryStream ms = new MemoryStream (ByteArrayToCurrentDomain (th.Internal._serialized_principal));
@ -266,7 +271,6 @@ namespace System.Threading {
th.principal_version = th.Internal._serialized_principal_version;
return th.principal;
}
[SecurityPermission (SecurityAction.Demand, ControlPrincipal = true)]
set {
Thread th = CurrentThread;
@ -288,6 +292,11 @@ namespace System.Threading {
}
}
public static AppDomain GetDomain() {
return AppDomain.CurrentDomain;
}
#endif
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static Thread GetCurrentThread ();
@ -308,10 +317,6 @@ namespace System.Threading {
}
}
public static AppDomain GetDomain() {
return AppDomain.CurrentDomain;
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern static int GetDomainID();
@ -418,13 +423,11 @@ namespace System.Threading {
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static void Abort_internal (InternalThread thread, object stateInfo);
[SecurityPermission (SecurityAction.Demand, ControlThread=true)]
public void Abort ()
{
Abort_internal (Internal, null);
}
[SecurityPermission (SecurityAction.Demand, ControlThread=true)]
public void Abort (object stateInfo)
{
Abort_internal (Internal, stateInfo);
@ -483,7 +486,7 @@ namespace System.Threading {
}
}
void StartInternal (IPrincipal principal, ref StackCrawlMark stackMark)
void StartInternal (object principal, ref StackCrawlMark stackMark)
{
#if FEATURE_ROLE_BASED_SECURITY
Internal._serialized_principal = CurrentThread.Internal._serialized_principal;
@ -724,5 +727,7 @@ namespace System.Threading {
throw new ThreadStateException ("Thread is dead; state can not be accessed.");
return state;
}
public static int GetCurrentProcessorId() => global::Internal.Runtime.Augments.RuntimeThread.GetCurrentProcessorId();
}
}